(CNN) -- The president of Malawi has pardoned two gay men who were sentenced to 14 years in prison this month for gross indecency and unnatural acts, the country's solicitor general, Anthony Kamanga, said Saturday.

President Bingu wa Mutharika announced his pardon of Steven Monjeza and Tiwonge Chimbalanga after meeting with U.N. Secretary General Ban Ki-moon, Kamanga said.

Authorities arrested Monjeza and Chimbalanga in December at their home in Blantyre, Malawi after the couple professed their love in a traditional engagement ceremony. Police discovered the couple when local newspapers reported on their engagement ceremony.

The criminal case against them cast a light on prevailing African attitudes toward homosexuality, which is outlawed in more than 30 nations on the continent.

The White House said it is pleased to learn of the pardon, stressing that the people are "not criminals and their struggle is not unique."

"We must all recommit ourselves to ending the persecution and criminalization of sexual orientation and gender identity. We hope that President Mutharika's pardon marks the beginning of a new dialogue which reflects the country's history of tolerance and a new day for lesbian, gay, bisexual, and transgender rights in Malawi and around the globe," it said.

Welcoming the action, the British government said, "Human rights apply to everyone regardless of their sexual orientation or gender identity."

"Britain has a close and strong partnership with Malawi and it is in this spirit that we raised our concerns about these convictions with the Government of Malawi," Britain said in a statement.

Some in the conservative southern African nation of Malawi supported the prosecution, and government officials have said they were simply upholding the law. Human rights groups and advocates for gays and lesbians argued that the arrests violated Malawi's constitution, which outlaws discrimination.

Monjeza and Chimbalanga are in their 20s.

While they were awaiting trial, they were subjected to medical examinations intended to find evidence of sodomy, according to Human Rights Watch. They also underwent psychiatric evaluations. All the exams were done without the men's consent, the group said.

The director of an organization that helped provide legal support to the couple, Gift Trapence of the Center for the Development of People, welcomed the news.

The president's decision provides an example to African governments and the world in general, he said.