NATO allies have agreed to provide increased military support, including surveillance planes, to Middle Eastern and North African countries whose governments are in conflict with hardline armed groups such as the Islamic State of Iraq and the Levant (ISIL, also known as ISIS).

NATO Secretary General Jens Stoltenberg on Saturday said alliance leaders also agreed to launch a new naval mission in the Mediterranean Sea, and made commitments to maintain a stable military presence in Afghanistan and to fund Afghan security forces through 2020.

"Today we have taken decisions to strengthen our partners and to project stability beyond our borders," Stoltenberg told reporters on the second day of a crucial NATO summit in Warsaw.

He said millions of people in Africa and the Middle East have been rendered "homeless and helpless" by organisations such as ISIL.

In response, Stoltenberg said NATO will start a training and capacity-building mission for armed forces in Iraq, a country he called central in the fight against ISIL.

Mediterranean patrols

NATO is also working to establish an intelligence centre in Tunisia, a major recruiting ground for ISIL, and will shortly start providing support to Tunisian special operation forces, he said.

US President Barack Obama and leaders of the other 27 NATO countries also reportedly agreed in principle for alliance surveillance aircraft to provide direct support to the US-led coalition fighting ISIL in Syria and Iraq, a decision the NATO chief called "a clear signal of our resolve to help tackle terrorism".

NATO diplomats said they expected flights by alliance AWACS planes to begin this autumn.

OPINION: NATO's meeting in Warsaw is the 'Second Chance Summit'

Stoltenberg said the alliance will launch a new maritime operation in the Mediterranean called Operation Sea Guardian, whose responsibilities will include "counterterrorism".

NATO will also cooperate with the European Union's efforts to shut down human-smuggling operations that have led to Europe's greatest refugee crisis since World War II.

The alliance will also increase cooperation with Jordan, and is preparing to help the new government in Libya design policies and institutions to help it better defend itself against armed groups, Stoltenberg said.

"We will provide greater support to our partners, so they can secure their countries and push back against violent extremism," he said.

Afghan extension

Obama urged his fellow NATO leaders in Warsaw to expand their support for the war in Afghanistan against the Taliban. Meanwhile, violence in the US led the US leader to cut his Europe trip short to return home on Sunday.

The US has pledged $3.5bn annually to fund Afghan forces, and the government in Kabul is expected to contribute as much as $500m. Allies would provide the remaining $1bn.

The funding would maintain a total of 352,000 Afghan Army troops and police officers.

"We are very close and I am certain we will reach that (funding) level," Stoltenberg told reporters. A senior US administration official said NATO has commitments for about 90 percent of the goal.

Stoltenberg said it was too soon to say exactly how many troops individual allies will agree to keep in Afghanistan under NATO's Resolute Support training and advisory mission.

But he said he believed that force levels would remain largely stable, based on commitments made on Saturday. Specific numbers will be finalised this autumn, he said.

READ MORE: NATO leaders discuss perceived Russian threats

Obama administration officials said they believe the number of forces dedicated to the NATO mission will be a bit more than 12,000. The officials were not authorised to discuss the details publicly and spoke on condition of anonymity.

US Army General Curtis Scaparrotti, the NATO supreme commander, told reporters the US has pledged about 6,700 of that total, about 200 fewer than it currently provides.

He said training and advising of the Afghan air force and special operations forces would be affected. But he added there will be fewer US troops training Afghan conventional forces, although the US will still send teams into the region to assist the army and police.

Earlier this week, Obama announced that overall he would keep 8,400 US troops in Afghanistan, rather than cutting their numbers to 5,500 as he had once planned. In addition to taking part in the NATO advisory-and-assist mission, the US has special operations forces in the country that conduct counterterrorism missions.

The planned force levels allow NATO allies to remain in regional hubs around Afghanistan, with Germany in the north, Italy in the west, Turkey in the capital of Kabul and the US in the east and south.

Baltic deterrence

The Warsaw summit, NATO's first in two years, was considered by many to be the alliance's most important since the Cold War.

On Friday, NATO leaders approved the deployment of four multinational battalions to Poland and the Baltic states to deter Russia, as well as a Romanian-Bulgarian brigade for the Black Sea region.

READ MORE: Is Eastern Europe entering a new Cold War?

Germany will lead a multinational battalion in Lithuania, with similar battalions to be led by the US in Poland, Britain in Estonia and Canada in Latvia.

A spokesman for Russian President Vladimir Putin said Moscow is willing to cooperate with NATO, even though he said it treats Russia like an enemy.

Russia "has always been open for dialogue" with NATO, especially to fight the "genuine threat" of "terrorism", Dmitry Peskov said.

"Russia is not looking [for an enemy] but it actually sees it happening," Peskov told reporters in Moscow. "When NATO soldiers march along our border and NATO jets fly by, it's not us who are moving closer to the NATO borders."