Updated

Muammar al-Qaddafi's forces shelled the rebel-held city of Misrata on Thursday, killing nine people. Regime supporters and opponents battled on another front in western Libya for control of a crossing point along the Tunisian border, killing refugees as they fled.

Rockets and other artillery fire slammed into Misrata's western Garara neighborhood, sending up deadly showers of shrapnel. At the city's Hikma hospital, relatives shouting "God is great" collected the dead, each with the word "martyr" written in black marker on their white funeral shrouds.

The two-month battle has wrecked swaths of Libya's third-largest city and prompted dire warnings of a humanitarian crisis. Qaddafi's best trained forces are battling fiercely to try to uproot rebel fighters from their only major stronghold in the western half of Libya, which is home to the government's power centers and the capital, Tripoli.

"Everything was normal and nothing was going on, and then all of a sudden these missiles came down and exploded in our neighborhood," said 46-year-old Ali al-Ghoul, who was leaving a mosque when five rockets struck nearby.

In fighting along the Tunisian border, control of the Dehiba crossing point was switching between the two sides Thursday. Rebels seized it a week ago, and government forces trying to retake it fired Grad rockets, including some that hit Tunisian soil, according to Tunisia's state news agency.

The fighting sparked panic among refugee families who had just crossed or were trying to cross the border, said witness Mohamed Hedia, a resident of the town on the Tunisian side of the border. There was no confirmed death toll, but Hedia said the dead numbered about 20.

About 5,000 people have crossed the border from Libya over the past two days, Tunisia's state TAP news agency reported. Many are being taken in by Tunisian families in the region or being housed in a refugee camp.

Misrata has become the focus of fighting in recent weeks, as the other key front, in the largely rebel-controlled east, has settled into a stalemate.

On Thursday, government troops shelled residential areas about 12 miles (20 kilometers) from Misrata's downtown core.

"The shelling started around 9:30 this morning and has been sporadic during the day," said a doctor who spoke via Skype on condition of anonymity for fear of reprisals.

Another doctor in Misrata said Thursday that a NATO airstrike killed 12 rebels in a friendly fire incident a day earlier. The military alliance, which is operating over Libya to enforce a no-fly zone and protect civilians, denied its warplanes bombed a building the rebels were said to be occupying.

Dr. Hassan Malitan said he believed the attack was a mistake but insisted it was caused by NATO aircraft. He said the strike came moments after he and another doctor visited the building where rebels were holed up about three miles (five kilometers) east of the port.

"We drove about 200 yards and we heard a huge explosion that shook the earth," Malitan said. He said he looked back and saw smoke rising from where they had just sat with the men. As he and the other doctor began slowly driving back toward the building, a second missile crashed into it, Malitan said.

"We started crying and screaming out their names," he said. "It was clear that the missiles came from the sky and we heard the airplane," he said.

Malitan said he was surprised to see rebels so far east, and said they assured him that they had been in contact with NATO forces about their location.

Wednesday was the second day of intense fighting around Misrata's Mediterranean port, the city's only lifeline to the outside world. A steady stream of boats have been bringing in humanitarian aid through the port and ferrying out hundreds of wounded civilians and foreign migrant workers who were trapped when the fighting broke out two months ago.

In Brussels, a NATO official denied that warplanes had bombed the building.

"There was no NATO attack on any building in or around Misrata," said the official who could not be identified under standing regulations.

Forces loyal to Qaddafi had been crowding around that area, a coastal road that leads from the capital, Tripoli, to the port. NATO forces targeted them in pummeling airstrikes on Tuesday and Wednesday in an attempt to halt an advance on the port.

The NATO spokesman said the jets had struck a number of combat vehicles about 10 miles (16 kilometers) southeast of Misrata port on Wednesday, targeting an area where they had broken up a large group of pro-Qaddafi forces the day before.

"NATO cannot independently verify reports that these vehicles were operated by opposition forces," he said. "We deeply regret any loss of human life, as our mission in Libya is to protect civilians and civilian-populated areas against attack."

Aid agencies and human rights groups have sounded alarm bells about a growing humanitarian crisis inside the city and NATO has publicly acknowledged it needs to do more to protect civilians in Misrata.

But the coalition has also talked about the difficulties of targeting Qaddafi's forces around the city, saying they are mixing in with civilians to make it more difficult to identify them.

On Thursday, a senior U.N. official warned that massive food shortages will also hit Libya within two months unless stocks are replenished and distribution networks are supported.

The World Food Program's regional director for the Middle East and North Africa, Daly Belgasmi, said current stocks might last only 45 to 60 days, after which many people will be forced to cut back on meals.

He said rising fuel prices and lack of hard currency are making it hard for Libya to import food. Adding to Libya's woes, the private economy was hit by the exodus of foreigners who worked in food production such as bakeries.

Belgasmi said government-run distribution networks have also come under pressure due to the conflict.