Tripoli, Libya
An aerial shot taken from a helicopter shows the Libyan capital of Tripoli. Mahmud Turkia/AFP/Getty Images

Troops in balaclavas guard the gate, and foreign diplomats arrive daily with offers of aid at Tripoli's Abusita naval base, where Libya's new U.N.-backed government has begun trying to bring a chaotic country under its control.

Even just beyond Abusita's well-guarded walls, though, Tripoli is not always a welcoming city.

Since they arrived by ship last month after attempts to fly into Tripoli were blocked, Prime Minister Fayez Seraj and his deputies have edged cautiously into a capital still controlled by a mosaic of armed brigades.

Seraj is under huge pressure from Libyans impatient to put insecurity and economic uncertainty behind them after years of fighting among rival units of former rebels who vied for power after the 2011 fall of Moammar Gadhafi.

Western allies are also keen for a stable Libyan partner to help them contain the growing reach of Islamic State group militants and block the flow of illegal migrants across the Mediterranean.

"We will start operating and working once we see things are settled and we are not creating any bloodshed," Ahmed Maiteeg, a deputy prime minister of the Government of National Accord (GNA), told Reuters.

The GNA has secured at least six ministerial buildings in Tripoli, he said. Others remain under the control of various semiofficial armed groups whose loyalty is often uncertain.

Seraj's U.N.-backed government is an attempt to bring together an alliance that took over Tripoli in 2014 to form its own self-declared government, and an eastern administration set up by the recognized Parliament in the far east of the country.

So far it is still trying to broaden its support, talking to opponents both in the capital and in eastern Libya, where it is seeking a vote of approval by the recognized House of Representatives.

"We're reaching out to all sides," Maiteeg said. "This is a government of accord, so we're trying to be as flexible with everybody as possible."

But the GNA's ability to move deeper into Tripoli will depend on the city's numerous armed brigades, which are often on the payroll of ministries or city councils but whose political alliances are difficult to read.

So far the capital has been relatively calm.

The coalition of brigades known as Libya Dawn, which brought the National Salvation government to power in Tripoli in 2014, has fractured. Attempts to block the GNA have so far failed — including the closure of Tripoli's airspace to prevent GNA leaders from flying in.

Hashem Bisher, commander of the powerful First Division brigade, said as many as 80 percent of armed groups now support the GNA.

In Martyrs' Square, where Bisher's men are present and where protests used to be exclusively pro-Dawn, two modest demonstrations rallied peacefully for and against the GNA on Friday.

Behind the Scenes

Abdurrahman Swehli, a pro-GNA politician recently elected to head a re-formed version of Tripoli's Parliament, said the arrival of the unity government's leaders had gone "much better than expected" on March 30.

"We were working behind the scenes for weeks, and the crunch came on that Wednesday," he said. "I was worried."

Swehli said the risk of violence was diminishing daily, and there was "no chance" the brigades could "continue as before without anyone controlling them."

But retaining and expanding support from brigades, let alone bringing them under political control, will be a delicate task.

Armed groups have switched allegiances rapidly and often act with autonomy in parts of the city they control. They have inserted their men into ministries and guard the streets with checkpoints and heavy artillery.

In the past, armed brigades allied with rival political leaders have invaded Parliament, taken over ministries and even kidnapped a prime minister, claiming to act in the name of the revolution.

Personal or property disputes often erupt into battles, and the nighttime hours can be punctuated by heavy gunfire.

Bisher acknowledged the expectation of "security breaches" had delayed a handover at some ministries and that one pro-GNA brigade had pushed for exclusive control at the prime minister's office, against the wishes of the new government's leaders.

He said his men were ready to join the police but could not yet integrate fully because of continuing insecurity.

"The problem is that if we give up our weapons, who will defend us?" he said.

Adel Algeryani, the political chief of another armed brigade, the Libyan Revolutionaries' Operations Room (LROR), said some groups wanted to see GNA leaders address the concerns of hard-line Tripoli opponents, including Libya's Grand Mufti.

He said a recent statement put out in the LROR's name promising a "long war" against the GNA had been a fake. But he would wait to see if the GNA could get more political and popular backing before committing to support it.

"I will try to push my friends to go as much as possible to the gray area," he said, describing advice to the group's members to avoid committing fully to supporting the new government. "Don't be involved now — wait and see."