A patchy cease-fire between Sudan’s two rival generals held in parts of the capital on Wednesday night, as desperate residents looked for ways to escape the city after five days trapped by the chaotic fighting with dwindling stocks of water and food.

Evacuation from the capital, Khartoum, has proved intensely dangerous since conflict erupted over the weekend between Sudan’s military and a powerful paramilitary group, the Rapid Support Forces. But after days hunkered inside their homes, often as battle rages in the streets outside, more Sudanese and foreign nationals have sought to flee the city of five million people.

Nearly 300 people have been killed and over 3,000 wounded since fighting erupted on Saturday, the World Health Organization said. Many residents of Khartoum’s outlying neighborhoods, where there is less fighting, have already fled the city by foot, bus and car, following roads along the Nile that lead north toward Egypt or Port Sudan, or to safer areas in the south.

Conditions have deteriorated with dizzying speed in Sudan, even by the standards of modern warfare. Khartoum was already a fragile city before fighting erupted on Saturday, with frequent power outages and soaring food prices. Now it is in the grip of two well-armed, battle-hardened forces, led by generals who had been planning for conflict for months, despite talks that Western mediators hoped would let Sudan transition to a civilian government.

As conditions in the city have worsened, with reports of gunmen breaking into houses and attacking civilians — including a European ambassador — several nations have moved to help their citizens. But the challenges are steep.

Khartoum’s international airport, the scene of intense fighting that has destroyed at least 19 parked planes, is closed to all traffic.

Japan became the first country to announce a planned evacuation of its citizens — though it was unclear how — and Germany reportedly sent three planes, only to call off the rescue while they were en route.

The U.S. State Department has said that it has no plans for a government-coordinated evacuation, and has urged Americans in Sudan to shelter in place. The embassy in Khartoum declined to say how many Americans were in the country. But a U.S. official, speaking on the condition of anonymity to discuss sensitive matters, said that during the Covid pandemic, the embassy had counted about 19,000 Americans in Sudan, many of them dual nationals.

Security officials said that many people might be able to escape if the latest cease-fire held.

“It’s the civilians’ greatest opportunity,” said Dale Buckner, of Global Guardian, a U.S.-based security firm that has organized four evacuations by road since Saturday. The evacuees reached Egypt and Eritrea, he said.

But the violence spreading across Khartoum has made it much harder to evacuate people in recent days. “It’s too dangerous,” he said. “We don’t want to put our agents and their employees at risk.”

On Wednesday evening, the Sudanese military agreed to a Rapid Support Forces proposal for a 24-hour humanitarian cease-fire that would allow civilians to evacuate or to replenish their supplies. But with a similar effort having failed a day earlier, it was unclear if the truce would hold.

From early morning, warplanes pounded the international airport in an effort to rout R.S.F. fighters dug in there. R.S.F. troops on trucks parked in nearby streets, positioned between houses filled with cowering residents, tried to shoot down the fighter jets with antiaircraft guns.

Between the roving gun battles, sniper fire from high-rise buildings and unpredictable airstrikes, civilians seemed to face threats from every direction.

“It is a very bleak and dangerous situation,” said Ghazali Babiker, the head of Doctors Without Borders in Sudan. The chaos prevented its medics from treating patients or moving supplies. “We’re paralyzed,” he said. “We cannot move.”

In the upscale Riyadh neighborhood, paramilitary troops placed missile launchers in front of homes, leading families to abandon them for fear of airstrikes. In Nyala, in the country’s southwest, one resident said that the R.S.F. was ransacking offices and markets.

At the campus of the University of Khartoum, dozens of students and university personnel were stranded for almost four days, forced to hide, cook meals and pray in the basement of the library.

“All this was done with the vibrations of the building and the sounds of clashes,” said Al-Muzzafar Mohammed, one of the students. About 90 of them managed to evacuate on Tuesday afternoon, but one student was shot dead on Sunday and buried on campus, Mr. Mohammed said.

Two senior European Union officials have been attacked in recent days, one suffering a gunshot wound, and a convoy carrying U.S. citizens was hit with gunfire as it drove toward an American compound in Khartoum. Aid groups have reported raids on homes by soldiers and the deaths of workers.

Many of those attacks were attributed to the R.S.F., which said on Twitter that it had created a hotline to receive “complaints and distress calls from citizens” — an announcement that drew a derisive response from some residents.

The turmoil also deepened in the western region of Darfur. In the city of El Fasher, Doctors Without Borders said it had treated 220 wounded civilians, 34 of whom died from their injuries. In another city, Nyala, looters emptied warehouses filled with medical supplies.

“They took everything,” Dr. Babiker said.

The R.S.F. announced it would transfer a group of detained Egyptian soldiers to Khartoum, where they would be handed over to the Egyptian authorities “when the appropriate opportunity arises.” Egypt has said that the soldiers, held at an air base about 200 miles north of the capital, had come to Sudan for joint military exercises, and denied claims by R.S.F. fighters that Egypt was backing the army in the war.

Hours later, Egyptian news media reported that a first batch of the soldiers had landed back home, and that a second one was expected hours later.

The United States and other countries renewed their appeals to the two warring generals, the army chief Gen. Abdel Fattah al-Burhan and the paramilitary leader Lt. Gen. Mohamed Hamdan to stop fighting.

A Japanese government spokesman discussing its evacuation plan, Hirokazu Matsuno, told a news conference that about 60 Japanese nationals in Sudan were safe, although many were grappling with severe food and water shortages.

Other nations remained cautious, at least publicly, about their plans.

Germany flew three transport planes toward Sudan to evacuate about 150 of its citizens, only to scrap the plan during a refueling stop in Greece, the German newsmagazine Der Spiegel reported. Citing mission security, the German Defense Ministry did not confirm the cancellation.

Christopher F. Schuetze, Shashank Bengali and Abdi Latif Dahir contributed reporting.