The abduction was brief but audacious.

Gunmen from one of Libya’s many militias stormed a hotel where the prime minister has a residence and held him for several hours Thursday — apparently in retaliation for his government’s alleged collusion with the U.S. in a raid last weekend that captured an al-Qaida suspect.

The brazen seizure of Prime Minister Ali Zidan heightened the alarm over the power of unruly militias that virtually hold the weak central government hostage. Many of the militias include Islamic militants and have ideologies similar to al-Qaida’s. The armed bands regularly use violence to intimidate officials to sway policies, gunning down security officials and kidnapping their relatives.

At the same time, the state relies on militias to act as security forces, since the police and military remain in disarray after dictator Moammar Gadhafi was overthrown and killed in 2011.

Many militias are paid by the Defense or Interior ministries — which are in charge of the military and police respectively — however the ministries are unable to control them.

Not only was Zidan abducted by militiamen who officially work in a state body, it took other militias to rescue him by storming the site where he was held in the capital.

Zidan’s abduction came before dawn Thursday, when about 150 gunmen in pickup trucks stormed the luxury Corinthia Hotel in downtown Tripoli, witnesses said. They swarmed into the lobby and some charged up to Zidan’s residence on the 21st floor.

The gunmen scuffled with Zidan’s guards before they seized him and led him out at around 5:15 a.m., witnesses said. They said Zidan offered no resistance.

Later in the afternoon, government spokesman Mohammed Kaabar announced that Zidan had been “set free.”

A militia commander affiliated with the Interior Ministry said his fighters, along with armed groups from two Tripoli districts, Souq Jomaa and Tajoura, stormed the house where Zidan was being held, exchanged fire with the captors, and rescued him.

“He is now safe in a safe place,” said Haitham al-Tajouri, commander of the Reinforcement Force.

Zidan later appeared at a Cabinet session that was broadcast live. He thanked those who helped free him but gave no details and avoided blaming those behind the abduction.

“We hope this matter will be treated with wisdom and rationality, far from tension,” he said. “There are many things that need dealing with.”

The abduction was carried out by two state-affiliated militia groups, the Revolutionaries Operation Room and the Anti-Crime Department. They put out statements saying they had “arrested” Zidan on accusations of harming state security and corruption. The public prosecutor’s office said it had issued no such warrant.

The motive for the abduction was not immediately known, but it came after many militias and Islamic militants expressed outrage over the U.S. Delta Force raid Saturday that seized al-Qaida suspect Nazih Abdul-Hamed al-Ruqai, known by his alias Abu Anas al-Libi, from the street outside his home in Tripoli.

Al-Libi is alleged to be a senior al-Qaida member and is wanted by the U.S. in connection with the 1998 bombings of its embassies in Tanzania and Kenya, with a $5 million bounty on his head. U.S. officials say he is now being held on an U.S. warship.

Several militia groups angrily accused Zidan’s government of colluding with the U.S. in the operation and allowing foreigners to seize a Libyan on its own soil.

The Libyan government said the al-Libi raid was carried out without its knowledge. But its response has been mild. It asked Washington for “clarifications” about the raid, but some militiamen are convinced Zidan allowed the raid.