Can I replace a Mazda5 engine with a Ford engine? on 2008 Mazda Mazda5

Due to an internal failure I need to replace the engine (extended warranty won't cover it). A new Mazda engine is expensive ($4000) so I'm trying to find alternatives. I know Ford and Mazda are similar, so I was thinking -- is there any Ford engine that is compatible with a Mazda5 engine (manual transmission by the way)?
Thank you!

Asked by for the 2008 Mazda Mazda5