KABUL (Reuters) - Afghanistan faces the risk of a new spiral in violence following a series of attacks on civilians in the last few months but on the battlefield, security forces have been holding their ground, the top U.N. official in the country said.

The assessment by Nicholas Haysom, the U.N. Secretary General's Special Representative for Afghanistan, painted a mixed picture of the security situation some 18 months after international forces ended their main combat operations.

While the bomb attacks that killed at least 22 people in Kabul and the northern province of Badakhshan on Monday underlined how dangerous Afghanistan remains, fears that the Taliban would overwhelm security forces have not been realized.

However Haysom said he was deeply concerned about violence against civilians, with attacks continuing during Ramadan, Islam's holy month.

As well as suicide attacks on targets ranging from government officials and members of the judicial system to foreign security contractors, at least 200 people have been abducted on highways since the end of May.

"There is a risk, in my view, that the conflict may enter a new phase, which could see retaliatory acts of vengeance and an escalating spiral of violence," said Haysom, who is stepping down from his post after four years in Afghanistan.

He also pointed to progress in several areas, including public finances, as well as the launch of potentially vital strategic infrastructure projects and said political stability was vital for the progress to continue.

The Taliban, whose former leader, Mullah Akhtar Mansour, was killed in a U.S. drone strike last month, control more territory than at any time since they were ousted in 2001, including large areas of the strategic southern province of Helmand.

But they have not so far been able to take control of a province or major provincial center and Afghan security forces, which faced severe pressure and heavy casualties last year, appear to have strengthened their performance.

Haysom, who warned in March that the very survival of President Ashraf Ghani's government in 2016 would be an achievement, said the battlefield was "in a state of flux, with gains and reversals but neither side effecting clear dominance". Security forces faced major challenges including leadership, morale and recruitment.

"For now, though, they are holding their ground," he said in a briefing to the UN Security Council in New York on Tuesday.

(Reporting by James Mackenzie; Editing by Nick Macfie)