Members of the media mark white flags with TV initials at the Rixos hotel in Tripoli on Aug. 21, 2011. (PAUL HACKETT/REUTERS)

CNN’s Matthew Chance tweeted Wednesday that all journalists had been freed: “Rixos crisis ends. All journalists are out!” Chance had been updating the world on the intense situation in the hotel through his Twitter account.

(Read live updates on the situation in Libya here.)

Chance said the journalists negotiated for their release with the armed guards, who allowed them to leave in small groups if they arranged their own transportation. They left in cars provided by the International Committee of the Red Cross.

“We were able to gather everyone in four cars, no problem,” the Red Cross’s George Comninos told the Associated Press. “Of course, it was still a tense situation.”

There were serious concerns for the safety of the journalists, who were running out of food and water. The hotel, in close proximity to ousted Libyan leader Moammar Gaddafi’s compound, had been intermittently without electricity.

“Very dark, very quiet at the #Rixos some gunshots cracking outside. We raided the hotel larder and got tons of cheese!” Chance tweeted Monday.

The CNN correspondent said the guards, who were apparently unaware that Tripoli was mostly under rebel control, accused the reporters of being NATO spies. He told CNN that each time someone attempted to leave the hotel gunshots rang out.

Watch the BBC’s Matthew Price explain the situation inside the hotel.