By Maria Golovnina and Michael Georgy
TRIPOLI (Reuters) - NATO neared agreement on taking command of allied military operations in Libya on Thursday, but its warplanes failed to stop tanks re-entering the western town of Misrata and besieging its main hospital.
Turkey said NATO members had settled four days of wrangling over the command and aims of the campaign, which would be transferred from the United States to the Western military alliance within one or two days.
"Compromise has been reached in principle in a very short time," Turkish Foreign Minister Ahmet Davutoglu told reporters. "The operation will be handed over to NATO completely."
However, NATO ambassadors were still negotiating on the arrangements in Brussels and diplomats said there was not yet full agreement. A German government source said there was no deal yet on the command structure and the enforcing of a U.N. no-fly zone and it might take until the end of the week.
U.S. President Barack Obama, keen to extricate Washington from wars in Iraq and Afghanistan and criticized at home over the Libya operation, has said Washington wants to hand over responsibility for the Libya campaign to NATO within days rather than weeks.
At the United Nations, U.N. chief Ban Ki-moon warned of further action on Libya if Tripoli failed to comply with resolutions from the Security Council, which last week approved military action to protect Libyans seeking to end Muammar Gaddafi's rule.
"There is no evidence that Libyan authorities have taken steps to carry out their obligations under resolutions 1970 or 1973," Ban told the Security Council.
Ban said his special envoy to Libya had personally warned Gaddafi's government that the Security Council could take "additional measures" if Libya failed to comply with its demand for a ceasefire.
The African Union invited Gaddafi's government, the rebel opposition, the European Union, U.N. Security Council and neighboring Arab countries to discuss the crisis on Friday in the Ethiopian capital Addis Ababa.
The Libyan government, which welcomed the initiative, denies its army is conducting any offensive operations and says troops are only defending themselves when they come under attack.
State television reported Western air strikes on military and residential areas of the capital Tripoli in a sixth night of attacks on Thursday, prompting bursts of anti-aircraft fire.
Earlier, Western air strikes destroyed government tanks outside rebel-held Misrata, but other tanks inside the city were not hit, a resident said, underlining the difficulty of the U.N.-backed military mission to protect civilians.
Libya's government said it was in full control of Misrata, Libya's third city with a population of at least 300,000 people. Only a hardcore of rebels were holding out in the city, which is around 200 km (130 miles) east of Tripoli.
"These people are al Qaeda affiliates, they are prepared to die, they want to die, because death for them is happiness, is paradise. They know they are going to die," Libyan government spokesman Mussa Ibrahim said.
But an opposition spokesman said by telephone that rebels were still fighting there, and had killed 30 snipers who had been picking off civilians from rooftops in the town. Government warships had left the port.
"There were clashes today and our fighters managed to find a way to reach the snipers on rooftops and killed 30 of them," rebel spokesman Abdulbasset Abu Mzereiq said by telephone.
Western forces, having taken out Libyan air defenses, moved deeper into Libya on Thursday in search of other strategic targets.
Gaddafi's tanks rolled back into Misrata under the cover of darkness and shelled the area near the hospital, which was also under fire from government snipers, residents and rebels said.
"The situation is very serious," a doctor in the western town said by telephone before the line was cut off.
A resident said around 6,000 workers and family members from Egypt and other African countries were stuck in the port.
Elsewhere, clashes between rebels and besieging forces continued in the eastern frontline town of Ajdabiyah, said Abu Musab, who left the town by car with his family of 10.
"There is no water, no power and the bombing is random. Everyone has left," he said, adding that Gaddafi's forces were positioned to the east, west and south of the town.
"There are revolutionaries in the town and there is fighting going on right now."
Western commanders are hoping the rag-tag rebel force in eastern Libya will overthrow Gaddafi for them but there is now little movement on the eastern front line at Ajdabiyah, 150 km (90 miles) to the south of Benghazi.
France said it had hit an air base in central Libya and a government plane after it landed at Misrata airport. Al Arabiya television said coalition planes struck Sabha, a Gaddafi stronghold in southern Libya.
A Libyan official said fuel storage tanks and a telecommunications tower in Tripoli were among places hit. A target in the Tajoura district which a resident said was a military area was also hit twice on Thursday.
Libyan Deputy Foreign Minister Khaled Kaim said strikes had hit military and civilian compounds in the central Jufrah region and other targets in Tripoli, Misrata and south of Benghazi in the east, home to a emerging alternative government.
Libyan officials took Reuters journalists to a Tripoli hospital to see 18 male corpses, some charred beyond recognition, saying they were military personnel and civilians killed by Western bombing overnight.
It was the first time foreign reporters had been shown alleged victims of the air strikes and it was not possible to verify how many were civilians. Libya says dozens have been killed. Western forces deny any have been killed in the strikes.
Haitham al-Trablousi, a doctor in Tripoli, told Al Arabiya television by telephone: "There are no civilian casualties and the bombing is very accurate....All the bodies which we have seen on the Libyan channels are corpses of people killed during the intifada (uprising) in Zawiyah."
Seeking to allay fears of a protracted and bloody conflict, France said it could take days or weeks to destroy Gaddafi's military, but would not need months.
"You can't expect us to achieve our objective in just five days," Foreign Minister Alain Juppe told reporters.
(Reporting by Mohammed Abbas and Angus MacSwan in Benghazi, Hamid Ould Ahmed and Christian Lowe in Algiers, Tom Perry in Cairo, David Brunnstrom in Brussels, Phil Stewart in Moscow, Andrew Quinn in Washington, Catherine Bremer, Emmanuel Jarry and Yves Clarisse in Paris; writing by Jon Boyle; editing by Mark Trevelyan)