Malawi has dropped charges against two men who were arrested under gay sex laws, after pressure from the US and UK.

The country’s government, which is heavily reliant on support from NGOs and Western aid money, had confirmed last year that it would no longer arrest people for same-sex sexual acts – an agreement first laid out in 2012 after a prolonged campaign.

That agreement appeared to be shattered this week when it emerged that 19-year-old Cuthbert Kulemela and 39-year-old Kelvin Gonani had been arrested, charged and detained on gay sex grounds.

However, after international governments voiced concern that the country was sliding backwards on equality, Malawi’s Justice Minister has stepped in to quash the case.

According to the Nyasa Times, Minister for Justice Samuel Tembenu said all charges against the two men had been dropped, while a “moratorium” on gay sex convictions will be introduced to adhere to “universally accepted human rights standards”.

He added that the government acknowledges the viewpoint that no one should be arrested on the grounds of their sexuality or gender identity, and re-committed to reviewing the country’s anti-gay laws.

However, he added that any law review would be carried out “in consultation with the people of Malawi as prescribed by the Constitution”.

It comes after the US Ambassador to Malawi, Virginia Palmer, took to social media to raise awareness of the case.

She wrote: “I am closely following the December 7 arrest of two Malawian citizens who were charged with sodomy in violation of section 153 of the Penal Code and subjected to a medical examination without their consent.

“I remind the government of its stated policy not to arrest, detain, charge, or pursue people engaged in consensual same-sex activity.

“The rights of LGBTI persons are human rights. As a matter of human rights, public health, and public order, LGBTI persons should not be discriminated against in any way.

“I urge the government to make good on its international human rights obligations, drop the charges, and resolve this unfortunate incident as quickly as possible.”

British diplomats also privately pressed the case with Malawi, after Scottish National Party MP Deidre Brock raised the issue in the UK Parliament earlier this week.

Addressing Secretary of State for International Development Justine Greening, Ms Brock asked: “Is the Secretary of State aware of the recent arrest in Malawi of two men for having consensual sex?

“Will the Government make urgent representations to the Malawian Government, echoing the calls of the US ambassador, calling on them to live up to their international human rights obligations and ensure that these charges are dropped?”

Ms Greening responded: “We will be making representations, and the hon. Lady is absolutely right to flag that up as a key area of human rights that needs to be addressed, wherever it takes place.”

Even Malawian commentators had expressed fear that if unchecked, the case could lead to a reduction in the sizeable aid contributions received from the West – on which the country is heavily reliant.

One Nyasa Times columnist warned not to “prick the backsides” of donors, writing: “Most people in England would be appalled to hear that people in this day and age are still being arrested for their sexual identities.

“And what many people in Malawi need to appreciate is that the people of England, America, Germany do not wish to see their tax money being spent in countries that discriminate on these grounds.

“Malawi can exercise its so called sovereignty if it wishes: continue this discrimination, and tear up the donor’s cheques in the process.”