MAZAR-I SHARIF, Afghanistan (Reuters) - Months of wrangling that have undermined the authority of Afghan President Ashraf Ghani’s Western-backed government ended on Thursday when the powerful governor of Balkh province agreed to step aside following a deal over his successor.

FILE PHOTO: Atta Mohammad Noor, Governor of the Balkh province, poses for a photo before an interview in Mazar-i-Sharif, Afghanistan January 1, 2018. REUTERS/Anil Usyan

Atta Mohammad Noor, who has defied Ghani’s attempts to remove him from office for months, said he would step aside, allowing Ishaq Rahgozar, a member of parliament from his own Jamiat-i Islami party, to move to the governor’s palace in the provincial capital, Mazar-i Sharif.

“Now that our demands have been met, I have decided to step down,” Atta Noor told a packed rally of supporters in the city, adding that he would stay in Mazar and remain active in politics, preparing for presidential elections next year.

Under the agreement, a new police chief in Balkh acceptable to Atta Noor was also confirmed on Thursday, while he was also expected to be allowed to name the new education minister in the national government as well as the ambassador to Kazakhstan.

The deal ends a damaging standoff that highlighted deep divisions in Ghani’s government as well as his struggle to impose his authority on the powerful regional leaders who dominate Afghan politics outside the capital.

Western diplomats had been alarmed at the crisis, which drew focus away from the fight against the Taliban and fueled fears of civic violence. The U.S. Embassy welcomed the accord “for putting the interests of the people of Afghanistan first”.

Balkh is one of the richest and most stable provinces in Afghanistan, sitting on lucrative trade crossings into neighboring Central Asian countries and with far less Taliban activity than adjacent provinces.

Ghani’s office announced in December that the president had accepted a previously signed resignation letter from the governor but the move backfired badly when Atta refused to go, declaring that Ghani had reneged on the terms of an agreement between the two.

At his office in Mazar, he received a stream of delegations, defying what he called the “weak, lazy and corrupt” government in Kabul and building his profile ahead of presidential elections next year, in which he is likely to play a key role either as candidate or powerbroker.

His position was helped by the strong political support and personal wealth he has built in more than a decade as governor as well as a long career that started as a commander in the anti-Soviet Mujahideen.

As well as underlining government weakness, the standoff highlighted the ethnic divisions that over the past two years have come increasingly to the fore in Afghan politics.

Atta Noor is one of the leaders of Jamiat-i Islami, a party mainly supported by Persian-speaking ethnic Tajiks from northern Afghanistan, many of whom have been bitterly resentful of Ghani, a Pashtun, whom they accuse of favouring his own ethnic group.

However his relations with other Jamiat leaders, notably Chief Executive Abdullah Abdullah, have also been difficult, with the two seen as potential rivals to lead the party in the presidential election.