TRIPOLI, Jan 29 (Reuters) - Libya's deputy prime minister survived unhurt after gunmen fired on his car in Tripoli on Wednesday in an attack reflecting the violent chaos plaguing the North African nation two years after Muammar Gaddafi's fall.

The Libyan government is struggling to contain dozens of unruly militias, former rebel brigades and militants who kept their guns after the NATO-backed revolt against Gaddafi in 2011.

Deputy Prime Minister Sadiq Abdulkarim said he had been attacked on his way from the Interior Ministry to the General National Congress assembly. He is also interim Interior Minister since the previous minister quit several months ago.

"I tell those who did it that Libya is bigger than you and Libya's men will not be threatened by bullets, guns or rockets," Abdulkarim said a two-minute statement on television.

The state news agency said he had not been wounded in the attack. Abdulkarim, who appeared healthy in his television appearance, said he had returned to work afterwards.

The identity of the attackers was unclear, an Interior Ministry official said.

Libya's difficulties in asserting state authority worry Western powers which fear that violence in the OPEC country could spill over to its North African neighbours.

Parts of Libya are already effectively under the control of militias, armed tribesmen and Islamist militant groups.

Libya's fledgling army and police, still in training, are no match for the militias that fought in the anti-Gaddafi uprising. The government has tried to co-opt them with state jobs but they often remain loyal to their commanders or local regions.

Security has deteriorated in recent months. More than 40 people were killed in fighting between rival groups and residents in Tripoli in October. Car bombs and assassinations have become part of daily life in the eastern city of Benghazi.

An armed blockade of three major eastern ports by a group demanding a greater share of oil wealth and more regional autonomy has choked off 600,000 barrels per day of oil exports.

Prime Minister Ali Zeidan's government faces a budget crunch due to the blockade, now in its sixth month. Oil exports, Libya's lifeline, have more than halved during the dispute. (Additional reporting by Feras Bosalum and Ulf Laessing; Writing by Ulf Laessing; Editing by Alistair Lyon)