KABUL - Taliban insurgents ambushed a convoy of Afghan security forces in a mountainous northern area on Monday, killing 22 soldiers and police, an official said, as bombs in Kabul and another area killed three.

The violence comes as the Taliban and their militant allies step up attacks ahead of the withdrawal of most foreign troops at the end of the year, seeking to weaken the new Afghan government that will take over most of the fight. The Taliban, who ruled Afghanistan with an iron fist from 1996 to 2001, attacked from the mountains as the convoy was travelling through Laghman Valley in Sar-e-Pul province, Gov. Abdul Jabar Haqbeen said.

Eight security forces were wounded and seven were taken captive. “Twelve army and police vehicles are totally destroyed,” Haqbeen said.

A suicide car bomber rammed a Nato military convoy along a major road out of Afghanistan’s capital, Kabul, early on Monday, killing one Afghan civilian, authorities said. The Taliban claimed responsibility for the attack on the Jalalabad Road, a main thoroughfare with a US military base and a housing compound for UN and other international contractors and aid workers. At least three foreigners were wounded in the blast targeting their armoured vehicles, but their identities were not known, police said. A spokesman for the US-led Nato mission in Afghanistan said a patrol was attacked but there were no fatalities among the international force. The force does not confirm injuries.

The bomber in a Toyota Corolla car drove into the convoy just before 7 a.m. (0230 GMT), said Farid Afzali, head of Kabul’s police investigation department. “As a result of the blast, one of our countrymen was killed and three foreigners slightly wounded,” Afzali said. Reuters television footage showed the remains of one of the white armoured vehicles, its engine blackened and mangled and side door damaged. It was the second car-bomb attack on international forces in Kabul in a month.

Taliban spokesman Zabihullah Majahid said on Twitter that the target was a foreign military convoy and several troops were killed. The insurgents, who are fighting to expel foreign forces and re-establish their strict Islamist state driven from power in 2001, often exaggerate the results of their attacks.

In the eastern province of Nangarhar, a suicide bomber detonated his explosives in front of a clinic killing two people and wounding seven, the Ministry of Defence said. A bomb planted in a crowded market in the Qarabagh district of Kabul wounded 22 civilians and five of them were in critical condition. Four children were among wounded, said district governor Samih Sharifi.

The Taliban took advantage of weeks of political paralysis over a disputed election to regain territory in provinces such as Helmand in the south and Kunduz in the north. President Ashraf Ghani appealed in his inauguration address late last month for the militants to join peace talks but they denounced his government for signing a security pact with the United States, calling it a “sinister” US plot to control Afghanistan.

Meanwhile, an Afghan official said a Nato air strike killed seven civilians in the country’s east, including a nine-year-old child, but the international coalition said on Monday the strike killed eight militants who had fired on its forces.

Civilian casualties from air strikes remain a raw issue in the Afghan war, although UN statistics show the number killed has sharply dropped in recent years.

The deputy governor of Paktia province, Abdul Wali Sahi, said villagers brought seven bodies from the Udkey area of Gardez city to the provincial capital, saying they were all civilians killed in an air strike.

Sahi said an investigation has been launched, but that initial reports suggested the villagers were gathering firewood on a mountainside for the upcoming winter on Sunday when they were fired on.

“They had shovels in their hands, and coalition forces maybe thought they were insurgents,” Sahi said.

A spokesman for the US-led military coalition, Lt. Col. David Olson, said he could confirm a “precision air strike” in the area after coalition forces came under fire. “The result of this strike was eight enemy killed,” he said.

The Taliban insurgency and the militant Haqqani network are both active in Paktia province.

It is often difficult to immediately determine whether those killed in air strikes are civilians or insurgents. The UN estimated in July that air strikes accounted for 1 percent of the nearly 5,000 deaths and injuries of civilians in the first half of 2014.

Civilian casualties were one of the reasons that former President Hamid Karzai cited for refusing to sign a bilateral security agreement with the United States to allow a small US force to stay after the end of this year. Karzai’s successor, President Ashraf Ghani, signed the security deal the day after taking office.