For months, the Rixos Al Nasr Hotel in downtown Tripoli has been a kind of luxurious detention center for journalists covering the Libyan uprising. The reporters called it the Hotel California — a place where you could check out anytime you liked, but never without a government minder or spies watching your every movement.

On Sunday and Monday, the $500-a-night hotel became a terrifying prison.

With power out and rebels pouring into the city, about three dozen journalists remained inside the hotel, trapped by armed men loyal to Libyan leader Moammar Gaddafi. The journalists lit candles, donned body armor and waited, unable to venture out to report on the story they were there to cover: the fight for the Libyan capital.

By nightfall Monday, the hotel appeared to be in one of the few pockets of the city still under Gaddafi’s control.

“Very dark, very quiet at the #Rixos some gunshots cracking outside,” tweeted CNN correspondent Matthew Chance, about 4:15 p.m. EST, during one of the intermittent power surges. “We raided the hotel larder and got tons of cheese!”

Chance and others described bullets whizzing past their windows, explosions from rocket and mortar fire and the chatter of machine guns. “#Rixos getting hit by stray bullets,” Chance tweeted about 1:30 p.m. Monday, or 7:30 p.m. in Libya. “Everyone really worried about what’s going to happen to us.”

Missy Ryan, a Reuters correspondent at the hotel, offered her take early Monday: “Dont want to hype situation. Doors not locked but we’re unable to leave due to guards, snipers. May change in next few hrs inshallah,” she wrote, using the Arabic word for “God willing.”

Instead, the situation only got worse.

As night fell, reporters collected in the interior of the hotel to avoid stray bullets crashing through the glass facade. They gathered up food and bottled water, determined to ration both if the siege lasted for days.

The reporters had already met to consider their escape options, according to Matthew W. Price, a BBC correspondent who described the unfolding situation on the British news service’s Web site. “No route to the port, no boats there to take us out anyway,” he wrote. “We dined in flak jackets — helmets by our side.”

Meanwhile, reporters who were with rebel forces rode into the city, meeting almost no opposition. Richard Engel, NBC’s chief foreign-affairs correspondent, was the first American TV journalist to arrive in the city with the rebels after entering Libya last week through Tunisia. On Monday, he stood in Tripoli’s Green Square as the sound of celebratory gunfire thudded behind him.

“I thought I’d see the people from the Rixos. But there’s hardly anyone here,” he said via phone. Engel noted the grim irony of the situation: “I’ve got almost full access. The one place I can’t go is to the Rixos. If I did, I’d be a prisoner, too.”

Price and the others worried that the hotel — which was also home to government officials and only a mile from Gaddafi’s sprawling compound — might become a prime target for the rebels, though many of those officials fled with their families before the fighting in Tripoli began. On Monday night, however, one of Gaddafi’s sons, Saif al-Islam, appeared at the Rixos, telling reporters that government forces had lured the rebel army into a trap.

Journalists who’ve spent time at the Turkish-built hotel describe it as a palatial, low-slung facility, with ample gardens, comfortable beds, a spa, a modern gym and an indoor pool. But since journalists began arriving to cover the rebel uprising in February, it has had an air of surreality, too. Guards armed with AK-47s stood at the gates, which were decorated with a large photo of mangled corpses, supposedly from a NATO airstrike on the city. During the hours before NATO’s bombing, journalists would watch as the children of Libyan officials staying in the hotel would play. near their mothers.

Journalists could walk out the gates of the hotel grounds if they told the guards that they were headed to the small convenience shop across the street. From there, if they were daring, they could sneak away and get a taxi to take them elsewhere in the city. They usually weren’t picked up.

Whenever government minders wanted to assemble the journalists for a news conference or an outing on a tour bus, a two-tone chime — the bing-bong, as the journalists called them — would ring on loudspeakers in the hotel rooms, followed by heavily accented English over an intercom announcement asking them to come to the lobby.

But the atmosphere at the hotel began to change as government officials became more jumpy from the airstrikes, many of which hit Gaddafi’s compound. By mid-June, the atmosphere was much nastier, as government minders berated journalists and accused them of spying for NATO.

The Washington Post pulled its correspondent, Ernesto Londono, from the hotel in July over concerns about deteriorating security.

Staff writers Michael Birnbaum and Ernesto Londono contributed to this report.