The Italian had been captured, along with two colleagues, on January 15 as they inspected a sanitation project on the island. 

Mary Jean Lacaba, a Filipina, and Andreas Notter, a Swiss national, were freed in April.

Health problems

Vagni said he lost over 18kg in captivity, surviving mostly on dried rice and fish, and at one point contracted cholera.

Anastasia Isyuk, a spokeswoman for the International Committee of the Red Cross (ICRC), said that the Italian engineer was doing "remarkably well" despite his ordeal and his health problems.

The spokeswoman declined to discuss the terms of his release, but stressed that the aid agency had not paid a ransom.

Local news websites reported that Vagni was freed after the military had agreed to release two wives and children of a senior Abu Sayyaf leader.

The women and children had been arrested at a checkpoint on Jolo island, officials said on Tuesday.

Nur-Ana Sahidulla, the vice-governor of Jolo, confirmed that the two women had been released before Vagni was handed over to her.

"The wives played a big role in the release of Vagni," she told reporters. "They are innocent and are not facing any criminal charges."

'Goodwill money'

Sahidulla, who had been negotiating for the release of the hostage since the crisis began, said she gave them about $1,000 from her own pocket as "cigarette money" to the fighters.

"That was for goodwill. That money came from me," she told DZBB radio.

Abu Sayyaf fighters, who want an independent Islamic nation in the southern Philippines, had threatened to behead Vagni or Notter in April unless the military pulled back from the area where they were holding them.

Manila initially rejected the demand, but relented after the ICRC's president in Geneva made a rare public appeal for co-operation.

The group, which is also said to have links to the regional Jemaah Islamiyah group, has been blamed for the worst attack in the Philippines' history, in which a ferry in Manila Bay was bombed in 2004, killing 100 people.

The US government has placed the group, which is believed to have about 400 fighters, on its list of "terrorist organisations".