An cameraman who tried to leave the hotel compound "had an AK47 pulled on him", he said.

But, by Wednesday afternoon, the crisis reached an endgame. Chance said the captives had negotiated their release with the guards, who agreed they could leave in small groups.

"Rixos crisis ends," he wrote at 3.45pm in a Twitter message. "All journalists are out."

He said they expected the International Committee for the Red Cross and the Chinese embassy to send cars to pick them up, but there was pandemonium in the lobby of the hotel and the group had to go back upstairs, triggering fears that their hopes would be dashed.

Chance said that a group of Arabic-speaking journalists had a "heart to heart" with two of the Gaddafi loyalist guards who were then disarmed. There was then a rush to find a flag with the word "TV" written on it to put on the evacuation car, to prevent it become a target in an area that was still subject to fighting.

He reported that the BBC team left the hotel and Red Cross cars then arrived. Chance said he crammed into a vehicle with journalists from Reuters, Fox News and Associated Press.

"Now pulling out of the Rixos hotel after six days of a complete nightmare," he wrote. "Still a dodgy situation."

Minutes later he wrote: "We have been holed up together for what seems like an eternity. We could finally get out freedom!!!"

Finally he said he could see the rebels. "We are nearly there!"

Earlier in the day the situation had appeared to be worsening after a group of four other journalists, including New York Times reporter David Kirkpatrick, pulled up to the front gate of the hotel in a car and were ordered out of the car at gunpoint. The Associated Press reported that the driver was placed on the floor of the car park by one guard while the others were menaced at gunpoint and later taken inside the hotel.

"David and the photographer he is with were detained briefly at the Rixos Hotel but they are now free and unharmed," a spokeswoman for the New York Times confirmed.

With food and water running low and an increasingly tense atmosphere in the hotel, William Hague, the foreign secretary, said on Wednesday morning that the situation was being monitored "hour by hour".

"We are monitoring that very closely," he said at a press conference in London. "We are in touch with their news organisations. Of course we are concerned about their safety and the safety of anyone caught up in this fighting. We are also doing what we can to help through talking to the National Transitional Council, although they are not yet in control of that area, and to any others who may be able to help."

The area around the hotel saw heavy fighting, according to the rebels.

"There were bombardments on Bab al-Aziziya (compound), al-Mansoura area and another area near Rixos hotel," a rebel spokesman told Reuters. "Most of this bombardment was carried out by the regime's cells positioned in the Abu Salim area."

In a dispatch filed on Tuesday, Dario Lopez-Mills of the Associated Press wrote that fighting around the hotel had intensified.

"The smell of gunpowder hangs in the thick heat, along with sweat and a little fear. When the shooting is most intense, we take refuge in hotel's basement conference rooms.

"Two satellite telephones set up on a balcony were destroyed by gunfire, so we've stopped transmitting our material. We wait and worry the gunmen could turn hostile at any moment.

"There is no power and no running water. On Monday, we ate bread and butter. On Tuesday, the cook made french fries. Bottled water is running low.

"We don't know when it's going to end, and we see little of what happens."