Image copyright Reuters Image caption John Feeley spent most of his life working on Latin American issues

The US ambassador to Panama has quit because he says he is no longer able to serve under President Donald Trump.

John Feeley, a former Marine Corps helicopter pilot, said he was "honour-bound" to resign.

The US Department of State, which oversees American diplomats, learned of his resignation in late December.

It was not a direct response to Mr Trump's alleged use of the term "shithole" to describe Haiti and African countries.

"As a junior foreign service officer, I signed an oath to serve faithfully the president and his administration in an apolitical fashion, even when I might not agree with certain policies," Mr Feeley said in his resignation letter.

"My instructors made clear that if I believed I could not do that, I would be honor bound to resign. That time has come."

Under Secretary of State Steve Goldstein confirmed he was aware of Mr Feeley's planned departure ahead of the president's alleged remarks on Thursday.

He said the ambassador, a career diplomat who spent most of his life working on Latin American issues, was leaving for "personal reasons".

Some of Mr Trump's policies have caused uproar in the region, including most recently his decision to remove residency permits for thousands of Salvadorean, Haitian and Nicaraguan immigrants living in the US after natural disasters.

Mr Feeley is not the first State Department official to leave their post.

Elizabeth Shackelford, who worked in Nairobi for the US mission to Somalia, resigned in December.

She wrote in her resignation letter to Secretary of State Rex Tillerson that she was quitting because the US had abandoned human rights as a priority, according to Foreign Policy.

Mr Feeley will leave his post on 9 March 2018.