* Interim PM says gunmen attacked his home
* Parliament to hunt for new government chief
* Libya riven by political division and armed groups (Adds parliament comment, context)
By Feras Bosalum and Julia Payne
TRIPOLI, April 13 (Reuters) - Libya's interim prime minister handed his resignation to parliament on Sunday, just one month into the job, saying gunmen had tried to attack his family.
Abdullah al-Thinni's resignation adds to the growing chaos in Libya, where the government has struggled to control brigades of former rebels nearly three years after the fall of Muammar Gaddafi.
The General National Congress (GNC), the country's parliament, has not yet officially recognised Thinni's resignation and will decide what to do at its next session on Tuesday, a GNC spokesman said.
Thinni said he would stay in his post until the GNC selects a new prime minister.
"We are meeting now and we're looking for someone to replace him," Mohamed Ali Abdallah, head of the GNC's planning and budget committee, told Reuters.
In his resignation letter, Thinni said he and his family had been victim of a "cowardly attack" and he could not "accept to see any violence because of my position".
"I have decided therefore to present my apologies as I cannot accept this temporary position," the letter said, without giving details about the incident.
Ahmed Lamin, a spokesman for the prime minister's office, said no one had been hurt in the attack, which he described as a "near miss" outside Thinni's family home.
The post of interim prime minister is becoming difficult to fill. A suitable candidate must be able to bridge deep political divides in a parliament inter-laced with militia rivalries.
With no real national army, OPEC member Libya is struggling with its transition to democracy as the brigades of former rebels who once fought Gaddafi refuse to disarm and often challenge the state's authority.
Thinni was appointed in March after the GNC voted out his predecessor, Ali Zeidan who had failed to end a standoff with rebels who were occupying vital oil ports.
The final blow was Zeidan's failure to stop a tanker from illegally loading crude oil at one of the blocked ports.
Thinni's government reached an agreement to reopen two ports, but the return of steady oil revenues is not a given.
The two largest ports, Es Sider and Ras Lanuf, remain closed pending negotiations over the division of the country's oil wealth.
The attack on Thinni's family is the not the first time that a prime minister has been threatened.
Zeidan, who fled to Europe after he was removed from his post, was briefly abducted from his hotel by a militia last year. He often complained of being unable to govern because of political rivalries and pressure from militias. (Writing by Patrick Markey; Editing by Robin Pomeroy)