WARSAW, Poland -- NATO allies agreed Saturday to maintain a stable military presence in Afghanistan, bolstered by President Barack Obama's decision to make a smaller cut in U.S. troop levels than he had initially planned.

NATO Secretary-General Jens Stoltenberg said the allies also made commitments to continue to fund the Afghan security forces through 2020, and are "close to" the needed $5 billion per year.

"We are very close and I am certain we will reach that level," Stoltenberg told reporters following a meeting on Afghanistan on the second day of a NATO summit.

Obama has been urging NATO leaders gathered in Warsaw to expand their support for that war against the Taliban. Meanwhile, violence in the U.S. led him to cut his Europe trip short so that he can return home Sunday.

The U.S. has pledged to provide $3.5 billion annually to fund Afghan forces, and the government in Kabul is expected to contribute as much as $500 million. Allies would provide the remaining $1 billion, and those are the commitments that Stoltenberg said are nearly complete. The funding would maintain a total of 352,000 Afghan Army troops and police officers.

Stoltenberg said it's too soon to say exactly how many troops allies will agree to keep in Afghanistan under NATO's Resolute Support training and advisory mission. But he said he believed that, based on commitments made Saturday, force levels will remain largely stable at about 12,000. Specific numbers will be finalized this fall, he said.

Earlier this week, Obama announced he would keep 8,400 U.S. troops in the country, rather than cut their numbers to 5,500 as he had once planned.

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

Stoltenberg says NATO, founded in 1949, needs to adapt to confront an array of new threats to its member nations' security, including cyberattacks and violent extremism sparked by radical Muslim organizations like the Islamic State group.

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. Germany will lead a multinational battalion in Lithuania, with similar battalions to be led by the United States in Poland, Britain in Estonia and Canada in Latvia.

Those moves were strongly criticized Saturday by Mikhail Gorbachev, the former Soviet president during the Cold War.

"NATO has begun preparations for escalating from the Cold War into a hot one," Gorbachev was quoted as saying by the Interfax news agency. "All the rhetoric in Warsaw just yells of a desire almost to declare war on Russia. They only talk about defence, but actually are preparing for offensive operations."

The White House, meanwhile, announced Obama would cut his Europe trip short by one day in the wake of the attack in Dallas that killed five police officers and wounded seven others during protests over fatal police shootings of black men in Minnesota and Louisiana.

Obama will attend meetings in Warsaw on Saturday before heading to Spain for meetings with Spanish leaders and a visit with U.S. troops.

He returns to Washington on Sunday and will visit Dallas early next week at the request of Mayor Mike Rawlings.