Mozambique's military says it has regained full control of the coastal town of Palma 12 days after it was raided by militant Islamists who are affiliated with the Islamic State group.
An army spokesman said a "significant" number of militants were killed in the counter-offensive.
Local media reported that some residents who had fled were starting to return home and that some of their properties were looted.
At least 11,000 people were displaced after the militants invaded Palma on March 24 and dozens of civilians were also killed.
The attack also forced French energy giant Total to suspend operations and evacuate staff from its Afungi liquid natural gas (LNG) facility near Palma.
The United Nations said it recorded nearly 10,000 civilians that have made it to safety since the Islamist raid
Many were helped by aid agencies, such as the World Food Programme, which evacuated survivors by boat to Pemba.
"So we estimate that 50,000 people are affected at this moment, so we are, not only in Pemba but we have at other locations, outside of Palma as well were we preposition food so that IDPs that are either crossing on foot or by road will have food that we will be able to assist them with as well," said Shelley Thakral from the World Food Programme
An Islamist insurgency, known locally as Al-shabab, but with no established links to the rebel group in Somalia, has ravaged the Cabo Delgado region since 2017. The strategic province of Cabo Delgado borders Tanzania and is an area that is rich in natural gas.
The conflict had already killed more than 2,600 people and uprooted nearly 700,000 more from their homes.
Reports have said that children are also beheaded in the attacks, which capture towns.