A Greek car ferry has been hired as last-minute accommodation for Libya's embattled parliament, which has fled the country's civil war to the small eastern town of Tobruk.

The 17,000-ton Elyros liner has been deployed, complete with its Greek crew, as a floating hotel for a legislature clinging to power in the Libyan city that is last stop before the Egyptian border.

Tobruk is no stranger to last stands. In the second world war, British and Commonwealth forces endured months of attacks from Erwin Rommel's Africa Corps. Now the siege mentality is back.

Islamists and their allies have captured the capital, Tripoli, and most of Benghazi, the country's second city. Derna, the next town up the coast, has been declared an Islamic caliphate and the front line begins at Tobruk airport, where pickup trucks mounting anti-aircraft guns face out into the shimmering empty desert.

The small port is home to what remains of Libya's sovereign power. On one side of the bay, sitting on sandy bluffs, a hotel conference hall acts as chamber to the house of representatives, ringed by troops in sandy-coloured US-made Humvee troop carriers.

On the other, moored to a quay, is the white gleaming bulk of the Elyros, which usually plies it trade carrying cars and passengers between Greece and Italy, looming over a collection of grey naval patrol boasts.

"We had only three days to prepare everything in Tobruk, to find spaces for meetings, places to stay, internet, everything," said Dr Muftah Othman, head of the town's election commission. "If there is no ship, where will you stay?"

The mood on board is sombre. An escalator, switched on only for important guests, heads up above the car deck to restaurants and bars with bright lights and almost no people. Children of the parliamentarians who have fled with them play in the corridors while clusters of officials and women in shawls cluster around the tables, where they are served Pepsi and orange juice by the bemused crew in immaculate white uniforms.

"It is unusual, yes," says one steward. "The Libyans are very polite. We are here one week, maybe we stay months, we don't know."

Nor do Libya's parliamentarians. The small Libyan army is reeling from hammer blows from its foes. "We need time to build up our army and security and to develop our skills to run the country," says deputy speaker Mohammed Ali Shuhaib.

In one way, time is on the government's side. Weeks of fighting have seen it lose major cities but it still has control of Libya's vast foreign reserves abroad and oil fields at home. Hold the line, the theory goes, and parliament can build its army while Islamist forces diminish.

But in another way, time is running out, with Libya's conflict already shaping up as a regional war. Qatar and the United Arab Emirates, the big Gulf players, have each taken a side, Qatar for the Islamists, the Emiratis for the nationalists. Pentagon sources say the UAE and Egypt have launched air strikes against Libya Dawn, while Sudan is flying in weapons for the Islamists, making parliament's job of finding middle ground all the harder.

In Tobruk, cohesion is parliament's problem. The Islamists are not the biggest faction in Libya – they captured Tripoli after suffering catastrophic defeats in June's elections – but they are the most cohesive. The tribes ranged against them are fractured along ancient fault lines, some dating back centuries.

Uniting those tribes, then persuading at least some Islamists to end their boycott of the chamber, is likely to determine whether Libya's three-year experiment with democracy succeeds or fails.

Publicly, politicians are upbeat. "They should know, the people who are not coming, that we accept them," says Amal Bayou, a microbiologist and one of 32 female MPs.

"If they [Islamists] are against the parliament, they can say it here, they should know there is a place for them."

But MP numbers are falling. It is supposed to have 200 members, but some seats are unfilled, some boycotted, and a mixture of intimidation and logistical problems have seen attendance dwindle to 115, dangerously close to the point where credibility will drain away.

UN envoy Bernard Leon, arriving on Monday for his first visit, insisted he was optimistic. "This is a country, a society, that is fed up with conflict," he said. "We are going to spend the week developing contacts with the stakeholders."

Meanwhile, across Libya those stakeholders continue pummelling each other. Tripoli, occupied by Islamist-led Libya Dawn, is suffering power and water cuts. Human Rights Watch reported this week on house-burnings and attacks on ethnic minorities and journalists across the capital.

Without the means to counterattack, or much sign of international support, Libya's parliament clings on in Tobruk, its eyes on the Elyros, wondering if it will end up being less a floating hotel than a lifeboat.