LUSAKA, Zambia — Zambia's home affairs minister said on Tuesday that a U.S. ambassador who criticized the jailing of a gay couple for 15 years had "crossed the line," adding that the United States had responded to an official complaint by recalling him.

A court in the southern African nation last month sentenced the couple under the country's harsh colonial-era sodomy law.

Ambassador Daniel Foote said he was "personally horrified," adding: "meanwhile, government officials can steal millions of public dollars without prosecution, political cadres can beat innocent citizens ... with no consequences, poachers can kill numerous elephants... and face a maximum of only five years."

Zambia's President Edgar Chagwa Lungu addresses the 74th session of the United Nations General Assembly at U.N. headquarters in New York City, N.Y., on Sept. 25, 2019. Lucas Jackson / Reuters file

A furious President Edgar Lungu said publicly that he had complained to his American counterpart Donald Trump over the ambassador's comments. Embassy sources on Monday said Foote had been recalled. The embassy declined to give official comment.

"The dos and don'ts for those who represent nations in other nations are very clear. So if one crosses the line, it's not about bilateral relations between the two countries," Home Affairs Stephen Kampyongo told Hot FM radio.

"They (Washington) listened to the complaint," he said.

The New York Times, however, quoted analysts as saying the Zambian anger at Foote may have had more to do with his criticism of the Lungu administration for widespread corruption.

An embassy source on Monday told Reuters that Washington had decided to recall its ambassador because it was difficult for him to work in Zambia if his hosts did not want him.

The White House tweeted Wednesday, "The @StateDept was dismayed the Zambian government had declared that Mr. Foote’s position as ambassador was 'no longer tenable,' and went on to say, 'the U.S. firmly opposes abuses against LGBTQ persons...'"

Over the past decade, several African countries have come into conflict over LGBTQ rights with Western countries, many of which are paying a lot of their bills. The previous U.S. Obama administration cut aid to Uganda and Malawi over homophobic laws and policies, although Western condemnation sometimes provokes African leaders into taking more hardline positions.

Uganda announced plans in October for a bill that would impose the death penalty for gay sex, but it later backtracked after major aid donors said they were monitoring the situation.

Zambia receives hundreds of millions of dollars every year in financial support from the United States, some of which goes toward fighting HIV/AIDS.

Follow NBC Out on Twitter, Facebook & Instagram