(Adds quote, background)
BENGHAZI, Libya, Sept 1 (Reuters) - Libya's elected parliament, the House of Representatives, asked Abdullah al-Thinni on Monday to form new government for the oil-producing country, a parliamentary spokesman said.
Thinni, a former defence minister and career soldier, has been prime minister since March but his position has been challenged by a rival parliament that refuses to recognize the House of Representatives.
Libya is descending into anarchy as former rebels who helped topple Muammar Gaddafi in a NATO-backed uprising in 2011 have turned their guns on each other, seeking to set the country's political agenda and control its vast oil reserves.
"The House has reappointed Abdullah al-Thinni today as the prime minister, asking him to form a crisis government within a period of time not exceeding two weeks," the spokesman said.
The move came as the government said it had lost control of most ministries and state institutions located in Tripoli after rival armed groups took over the capital.
Last month, senior officials and the elected parliament moved to the remote eastern city of Tobruk as an alliance of armed factions led by forces from the western city of Misrata took control of Tripoli, having expelled a rival group.
All ministries, the central bank and the state-owned National Oil Corp (NOC) are located in the capital.
The continuing violence has not yet affected oil production but traders have said ownership of the oil might be subject to legal challenges if the Misrata forces take control of the central bank, where crude revenues are booked.
The new forces controlling Tripoli, some of which have Islamist leanings, have refuse to recognize the Tobruk House of Representatives, which has a strong liberal and federalist presence.
They have reconvened the previous parliament, the General National Congress, in which Islamists were strongly represented. (Reporting by Feras Bosalum and Ahmed Elumami; Writing by Ulf Laessing; Editing by Catherine Evans)