BOCA RATON, Fla. -- President Barack Obama hoped to turn Monday's final presidential debate here into a military lesson for Gov. Mitt Romney.

Obama, taking criticism from his Republican challenger for a shrinking U.S. military, fired back by saying he doesn't think Romney understands "how our military works.

"You mention the Navy, for example, and that we have fewer ships than we had in 1916. Well, governor, we also have fewer horses and bayonets because the nature of the military has changed," Obama quipped, adding planes land on aircraft carriers and submarines travel underwater.

"The question is not a game of Battleship or counting ships, it’s what are our capabilities.”

That exchange was a moment of levity in an otherwise serious debate about foreign policy with world hot spots like Libya and Iran figuring prominently.

Although the heated exchanges often turned to the economy, Obama tried to paint his opponent as inexperienced, indecisive and even dangerous on the issue of foreign policy.

”I know you haven’t been in a position to actually execute foreign policy but every time you’ve offered an opinion, you’ve been wrong," Obama said. "You said we should have gone into Iraq, despite that fact that there were no weapons of mass destruction.“ But Romney blasted Obama for his handling of Iran’s nuclear ambitions and sabre rattling towards Israel.

“I think from the very beginning, one of the challenges we’ve had with Iran is that they have looked at this administration and felt that the administration was not as strong as it needed to be. I think they saw weakness where they had expected to find American strength," Romney said. ”We’re four years closer to a nuclear Iran and we should not have wasted these four years.“ Monday's showdown — the third and final presidential debate in this election — focussed on foreign policy and centred around security issues like Iran and Israel, Libya and North Africa, the ongoing war in Afghanistan and ongoing turmoil in the Middle East.

Romney attacked Obama for projecting a weak image of the U.S. abroad, which had made the world a more dangerous place, and he questioned Obama's successes killing al-Qaida leaders as a long-term strategy to defeat Muslim extremism.

"We can't kill our way out of this mess. We’re going to have to put in place a very comprehensive and robust strategy to help the world of Islam and other parts of the world to reject this radical violent extremism." Romney said. "Attacking me is not an agenda. Attacking me is not how we deal with the challenges of the Middle East."

Generally, the incumbent has a huge advantage when it comes to foreign policy, but where Obama enjoyed an eight-point lead in the polls on international affairs last month, that lead shrunk to just three points in a NBC/Wall St. Journal poll over the weekend. The poll also showed Obama with 44% support and Romney with 41% when likely voters were asked who would make a better commander-in-chief.

Ahead of Monday's debate at Lynn University here, Obama was preparing at the presidential retreat of Camp David in Maryland, while Romney was holed up in a Florida hotel.

Following the first presidential debate earlier this month in Denver, which Romney decisively won, he has pulled even with and even passed Obama in the national polls, and has made the election a dead heat in several critical swing states.

Monday's debate was the last time Romney and Obama will share a stage before Americans head to the polls Nov. 6.