KABUL (Reuters) - More than 60 percent of Afghans still believe the country is headed in the wrong direction, but signs of better governance and rebuilding has slightly lifted the national mood, according to a survey by the Asia Foundation.

People climb up a hill to watch the sunset in Kabul, Afghanistan November 16, 2015. REUTERS/Mohammad Ismail

Just over half of the 10,000 people surveyed said they had confidence in President Ashraf Ghani’s government, which has struggled to establish security in the face of a growing Taliban insurgency. Last year, just under half of Afghans said they had confidence in Ghani.

However, nearly 39 percent of those surveyed said they would be willing to leave if they had the opportunity, the second highest figure in the survey’s more than decade-long history.

The main reason was increased security concerns. More than 70 percent of Afghans fear for their personal safety.

Attacks are up across the country. In May, more than 150 people were killed by a blast in Kabul’s diplomatic zone - one of the deadliest since the Taliban’s ouster in 2001.

On the day the survey was released, more than 20 policemen were killed in fighting with Taliban insurgents in the southern province of Kandahar.

The survey which was conducted in all 34 provinces of Afghanistan in July, primarily in rural households, pointed to a mixed picture, with steady gains in education and health over the past decade and a half matched by continuing concern over corruption, unemployment and security.

Around a third of Afghans, or 33 percent, believe the country was heading in a positive direction, up slightly from 29.3 percent last year to buck a years-long declining trend.

“After a historic decline in 2016, confidence in public institutions has slightly improved; growing confidence in the Afghan National Security Forces stabilized in 2017,” Abdullah Ahmadzai, Asia Foundation’s country representative in Afghanistan said in a statement.

The increase in optimism applied across ethnic groups except Uzbeks, who make an important minority in Pashtun- and Tajik-dominated Afghanistan.

While there was a slight rise in positive sentiment, it was down significantly from a peak in 2013 before the withdrawal of most foreign forces. Back then nearly 60 percent of Afghans were positive about their future.

The survey comes as the United States in August announced a boost in U.S. troops to Afghanistan, which could push optimism higher in the coming months.