A top Homeland Security official and friend of White House Chief of Staff John Kelly who lost a fight to extend "temporary" amnesty to tens of thousands of Central Americans has resigned.

James D. Nealon left his post Thursday as assistant secretary for international engagement in DHS’s Office of Strategy, Policy, and Plans.

An ambassador to Honduras under former President Obama, he was also the top deputy to Kelly when the general ran U.S. Southern Command. Kelly brought him into the Department of Homeland Security when he became secretary, before becoming Trump’s chief of staff.

A department official said that there were no outstanding issues prompting Nealon to retire.

But a critic said he was upset that his recommendations to extend so-called “temporary protected status” to some 200,000 immigrants from countries including El Salvador and Haiti were rebuffed.

A recent Breitbart report revealed a memo he wrote to top immigration officials in which he said those with TPS status “work legally in great numbers,” are “liv[ing] the American dream,” “have many thousands of American citizen children,” and “it makes no sense to send [citizens of Honduras, Nicaragua, and El Salvador] back to their country of origin.”

He also was part of a White House meeting in September with Mexican Foreign Secretary Luis Videgaray Caso and President Trump’s son-in-law Jared Kushner that discussed expanded worker visas and a solution to help hundreds of thousands of illegals in the Obama-era Deferred Action for Childhood Arrivals, or DACA.

Both those actions irked administration advocates of limiting immigration and promoting the president’s demand to “Hire American.”

His resignation comes at a time when Kelly is facing some fire over his White House management and a report he is willing to resign.

Paul Bedard, the Washington Examiner's "Washington Secrets" columnist, can be contacted at pbedard@washingtonexaminer.com