For the 500,000 residents of this once-prosperous port city, there is nowhere to run.

The city is surrounded by forces loyal to Moammar Gaddafi. His snipers lurk on rooftops and peer from open windows. Entire neighborhoods are off-limits because of indiscriminate artillery and mortar fire. Hospitals are overflowing with the wounded, some of them children.

For residents, it is not just a question of whether to fight, but how long they can survive. After living under siege for nearly two months, many are reaching their breaking point as Gaddafi escalates his attacks and supplies become ever more scarce. Lines for bread and gasoline go on for blocks. Sewage has seeped into the water system. Most of the city is run on generators or has no power. Cellphone service has been cut.

Misurata is the last opposition stronghold in western Libya, but it is unclear how long the ragtag rebel force will be able to hold out amid daily assaults by the government. To the rebels, this city is a potent symbol of resistance and a reminder that the uprising that swept the country in late February was not confined to the east. It also poses a dangerous threat to Gaddafi, giving his opponents a base that is uncomfortably close to the capital, Tripoli.

But unlike the rebels in the east, fighters in Misurata have no room to retreat when they are overwhelmed by government firepower. They also have only one way of getting supplies — the port — but few boat captains have dared to come ashore amid regular shelling. The city’s isolation has also kept most foreign journalists away, though some have arrived in recent days after a perilous journey by sea.

Without a reliable supply chain, would-be fighters must wait until a comrade dies so they can inherit his weapon. Most use old Kalashnikov assault rifles, stolen from a Gaddafi base soon after the uprising began.

Intense urban warfare

On the coastal road Monday, one fighter held up a soda bottle filled with gasoline and a diesel-soaked cloth.

“These are our antitank weapons,” said Ismail Kraweed, 23.

The rebels throw the homemade bombs at government vehicles, but to little effect.

Kraweed hid Monday behind dirt barriers fashioned in the middle of the street near an abandoned gas station scarred with bullet holes. Gaddafi’s forces loomed less than half a mile away. The rebels typically attempt to lure the government tanks into residential areas, so they can surround and try to destroy them.

As Kraweed and his fellow fighters waited to spring their trap, mortar shells sailed overhead and explosions rocked the city. Tripoli Street — the city’s main drag — has become a shell of its former self, with buildings along it reduced to rubble.

Overhead, snipers eyed their targets while camped out in the insurance building — the tallest on the block — and in an adjacent bank. Rebels said the snipers are remarkably efficient, picking off their marks with shots to the head and chest. Rebels don’t bother to operate at night, because the snipers use night-vision goggles to target anything that moves.

“We tried to blow up the buildings, but we don’t know how,” said Alaa el Deen Khesham, 30, a rebel fighter who until two months ago worked in public relations for the government. “We threw homemade bombs in there, but it didn’t do anything.”

He looked down with sadness: “We wish NATO would bomb the buildings.”

There are few signs in Misurata of NATO’s military campaign to protect civilians. The fighting is all urban warfare, making accurate strikes from the air especially difficult.

Among residents, there was mounting anger at what they saw as the international coalition’s failure to protect them against Gaddafi’s barrages.

“We are officially let down and disappointed by NATO,” said Mohammed, a city council spokesman who uses only one name for safety reasons. He said there apparently were no airstrikes in the area in the past three days, allowing Gaddafi’s forces to intensify their shelling of the port and the city’s residential and industrial areas.

“What is the mandate of NATO? It is protection of civilians, but civilians are dying in Misurata,” he said. “If they cannot do it, they should say they cannot do it.”

The rising toll

The United Nations said Monday that it had forged a deal with Gaddafi’s government to allow humanitarian aid into Misurata. But the agreement was met with skepticism in the city, and it is far from clear that the fighting will pause long enough for the aid to arrive.

In the meantime, the death toll climbs. Khesham said that a friend since childhood and fellow rebel fighter, Salah, was killed Sunday after being shot twice: in the thigh and in the head. He was buried the same night, after rebels burned down the building from which the sniper’s bullets had been fired.

Khesham was born in Germany and spent part of his childhood in Boise, Idaho. He has two homes in Tripoli and a sports car. But he gave it all up to fight with the rebels in Misurata.

Toward the end of the day Monday, he visited the Hikma hospital, which was overflowing with the wounded and the dead.

“How many martyrs today?” Khesham asked, his eyes turning red. A doctor checked: One was killed, and 26 were wounded.

“Do you know who?” Khesham asked.

“No,” the doctor said.

“This is the most difficult part,” Khesham said, as he sought to keep his composure. “I know these people from the fights and from my childhood, and it hurts a lot when they die.”

As Khesham walked away, four more people were carted in with bullet wounds to the chest. Around him, one man’s leg was destroyed by a blast, and others wept, crying out to God for help.

Correspondent Simon Denyer in Tripoli, Libya, contributed to this report.