Libya's prime minister Abdullah al-Thani stepped down on Sunday, saying he and his family had been the victims of a "traitorous" armed attack the previous day.
Thani quit less than a week after parliament tasked him with forming a new cabinet and a month after it ousted his predecessor for failing to rein in the lawlessness gripping the North African country.
He said in a statement that he would not accept the premiership after a "traitorous attack" on himself and his family, but he would stay on in a caretaker capacity until a new prime minister is appointed.
Amid controversy over his appointment, Thani, who was defence minister under ousted premier Ali Zeidan, was named on Tuesday.
"I will not accept Libyans killing each other over this post," Thani said in his statement addressed to the General National Congress (GNC).
Thani said the attack on Saturday had terrorised inhabitants of a residential district and "put the lives of some of them at risk", without giving specific details.
A source close to Thani told AFP that the incident took place on the road from the capital to its airport and caused no casualties.
As premier, Thani was faced with the daunting task of bringing former rebel brigades to heel following the 2011 NATO-backed uprising that ended Moamer Kadhafi's four-decade rule.
Libya has seen near daily attacks, particularly in the restive east, as well as a challenge from rebels who blockaded vital oil terminals for nine months, and a growing political crisis stemming from the interim parliament's decision to extend its mandate.
Omar Hmidan, a spokesman for the GNC, the country's highest political authority, said Thani was chosen after legislators failed to reach a consensus on other candidates.
Signup to our newsletter and follow us on Facebook and Twitter!
He was given one week to form a new government.
The decision to confirm Thani was rejected as illegal by some legislators, who said it had not received the required number of votes.
MP Suad Ganur said the decision, which was approved by 42 votes out of 76 members present, was "null and void" because it required 120 votes out of the 200-member assembly.
But Mokni said the larger margin of votes was not necessary because Thani had already been appointed acting prime minister by 124 votes.
The GNC on March 11 ousted Zeidan after the military failed to prevent rebels from sending a tanker loaded with oil out from a blockaded port.
After his ouster, Zeidan was replaced by the 60-year-old Thani, an army colonel who retired in 1997, initially on a temporary basis.
GNC spokesman Hmidan said Thani would remain in office until the election of a new parliament, the date for which has not been set.
The interim parliament sparked outrage earlier this year when it decided to extend its mandate from February until December.
A wave of protests compelled it to promise early elections and a new electoral law.