BLANTYRE, Malawi - Malawi's president on Saturday pardoned a gay couple who had been sentenced to 14 years in prison and ordered their release but insisted that homosexuality was still illegal in his conservative southern African nation.

President Bingu wa Mutharika announced the pardon on "humanitarian grounds only" during a news conference with U.N. Secretary-General Ban Ki-moon in Lilongwe, the capital.

"These boys committed a crime against our culture, against our religion, and against our laws," Mutharika said. "However, as head of state, I hereby pardon them and therefore order their immediate release without any conditions."

But he added: "We don't condone marriages of this nature. It's unheard of in Malawi and it's illegal."

Malawi had faced international condemnation for the conviction and harsh sentencing of Tiwonge Chimbalanga and Steven Monjeza, who were arrested in December, a day after celebrating their engagement.

After the pardon, activists were searching for a safe house for the couple, fearing they could be attacked upon release.

Ban praised Mutharika's decision but said "laws that criminalize sexuality should be repealed."

In Washington, White House spokesman Robert Gibbs also praised the move, urging an end to "the persecution and criminalization" of sexual orientation and gender identity.

Last week, the top U.N. AIDS official and the head of an international donor organization met with Mutharika and expressed concern that criminalizing homosexuality would keep a vulnerable group from seeking AIDS treatment.

Joseph Amon of Human Rights Watch said the president was responding to the international outcry.

"I hope that other leaders of African countries with antigay laws see that this is just not acceptable in the international community," Amon said by telephone from New York.

Malawi is among 37 African countries with antigay laws.

In Uganda, a proposed law would impose the death penalty for some homosexuals.