By Hamid Shalizi and Katharine Houreld
KABUL March 9 (Reuters) - The powerful Afghan vice president died of natural causes on Sunday, a government spokesman said, only weeks before Afghanistan goes to the polls to elect a new president.
Marshal Mohammad Qasim Fahim, vice president since 2009, had been a top commander in the Northern Alliance, a group of anti-Taliban militia leaders, during the civil war.
"Marshal M.Q. Fahim has passed away. May his soul rest in peace," presidential spokesman Aimal Faizi wrote in a tweet.
Fahim, a former defence minister, was a staunch backer of President Hamid Karzai and commanded great loyalty from former fighters of the Northern Alliance, which he headed after the death of famous militia leader Ahmad Shah Masoud in 2001.
His loyalties in the presidential election had swung between different candidates, said Davood Moradian, the head of the Kabul-based Afghan Institute for Strategic Studies.
Fahim had links with the both president's brother, who stepped down this week in favour of Zalmay Rassoul, another candidate close to the president, and Abdullah Abdullah, a former aide to Masoud, he said.
Fahim spoke little to the media, said Kate Clarke of the Kabul based thinktank Afghanistan Analysts Network, but wielded great influence in closed door meetings.
"Karzai, Fahim and the Americans have been the three key powers in Afghanistan since 2001," she said. "He was one of the key people to win over because he carries a lot of influence within ... one of the big political- military parties."
The polls are due to take place April 5. If they proceed normally, they will mark the first time in Afghanistan's history that power has been handed from one democratically elected government to another.
Hamid Karzai is barred by the constitution from seeking a third term. He has not offered his backing to any of the candidates.
The election is taking place against a backdrop of uncertainty and deteriorating security as U.S.-led forces in the country since the Taliban were ousted in 2001 are due to withdraw by the end of the year. (Editing by Jeremy Laurence)