ADEN - Yemen's exiled government announced Friday the "liberation" of second city Aden after four months of devastating fighting between loyalist forces and Iran-backed rebels.

But rebels continued to control some districts of the city, witnesses said, adding that fighting was under way in central areas of the southern port.

"The government announces the liberation of the province of Aden on the first day of Eid al-Fitr which falls on July 17," exiled Vice President Khaled Bahah said on his Facebook page, referring to the Muslim holiday marking the end of the fasting month of Ramadan. "We will work to restore life in Aden and all the liberated cities, to restore water and electricity," said Bahah, who is also the prime minister.

A statement by the government also confirmed the "liberation of Aden province".

On Tuesday, loyalist forces launched Operation Golden Arrow against Iran-backed rebels who seized control of much of Aden in March, forcing the government into exile in neighbouring Saudi Arabia.

The counteroffensive was carried out by southern militiamen of the Popular Resistance, backed by reinforcements freshly trained and equipped in Saudi Arabia.

The oil-rich kingdom leads a coalition of Arab countries which has been waging an air campaign against the Shiite Huthi rebels and renegade troops loyal to ousted president Ali Abdullah Saleh.

Aden was President Abedrabbo Mansour Hadi's last refuge after he fled the capital Sanaa earlier this year as the rebels took over the government and launched an offensive in which they seized much of the rest of the country. Swathes of the city have been reduced to rubble by the four months of ferocious fighting.

The exiled government's official news agency said loyalist forces had mopped up the last pockets of rebel resistance in the city's Mualla district on Thursday. They secured the airport and the surrounding Khormaksar diplomatic district earlier this week. On the ground, however, witnesses said that rebels were still in control of the Tawahi district of the city.

Clashes are raging on the edges of Muala, which leads into Tawahi, they said. Pro-Hadi fighters "are trying to advance towards Tawahi but they are facing resistance," said one witness.

Huthi fighters were also still holding onto their positions in Dar Saad northern neighbourhood and continue to control the northern and eastern entries into Aden, witnesses said.

Five civilians and seven southern fighters were killed in Muala and Crater districts, medical sources said.

Journalist Radfan al-Duwaish, who heads the South Voice local radio station, was also wounded when a bullet hit him in the head, an AFP correspondent reported.

In a televised speech to mark the Eid al-Fitr holiday, the exiled president paid tribute to loyalist fighters and vowed that Aden would be the stepping stone to victory nationwide.

"Aden will be the key to Yemen's salvation," Hadi said in the speech broadcast late on Thursday. "From Aden we will regain all of Yemen."

The loyalist counteroffensive came after the failure of a UN-declared truce that was supposed to have taken effect last weekend to allow the delivery of desperately needed relief supplies.

The United Nations has declared Yemen a level-3 humanitarian emergency, the highest on its scale.

More than 21.1 million people - over 80 percent of Yemen's population - need aid, with 13 million facing food shortages, while access to water has become difficult for 9.4 million people. Four months of fighting and air strikes have killed more than 3,200 people in Yemen.