Former Defense Secretary Jim Mattis took several implicit swipes at President Trump’s leadership in an op-ed published Wednesday, warning about the fallout from fractured alliances and increasing divisiveness under the current administration.

Mattis’ comments were included in a lengthy essay adapted from a forthcoming book and published in The Wall Street Journal. They amount to the most extensive remarks from him about his time in the Trump administration since he quietly resigned in January.

MATTIS TO RETIRE AT THE END OF FEBRUARY, TRUMP SAYS

In the essay, Mattis suggested he left his post as secretary of defense amid concerns about “keeping faith with our allies,” warning that America “cannot go it alone.”

“Nations with allies thrive, and those without them wither. Alone, America cannot protect our people and our economy,” Mattis wrote. “At this time, we can see storm clouds gathering.”

He pointedly added: “A polemicist’s role is not sufficient for a leader. A leader must display strategic acumen that incorporates respect for those nations that have stood with us when trouble loomed.”

Mattis said he “did as well as I could, for as long as I could” as secretary of defense.

In one section, he essentially wrote that he resigned when he felt his concerns about those alliances were not being taken seriously.

“When my concrete solutions and strategic advice, especially keeping faith with our allies, no longer resonated, it was time to resign, despite the limitless joy I felt serving alongside our troops in defense of our Constitution,” Mattis wrote.

Mattis went on to note his deepest concerns “as a military man,” noting they are “not our external adversaries; it is our internal divisiveness.”

“We are dividing into hostile tribes cheering against each other, fueled by emotion and a mutual disdain that jeopardizes our future instead of rediscovering our common ground and finding solutions,” he wrote. “All Americans need to recognize that our democracy is an experiment—and one that can be reversed. We all know that we’re better than our current politics.”

He added: “Tribalism must not be allowed to destroy our experiment.”

TRUMP PUSHES OUT MATTIS SOONER THAN PLANNED

Mattis announced his intention to resign in December 2018, after clashing with the president over the abrupt withdrawal of all 2,000 U.S. troops from Syria. At the time, Mattis delivered a resignation letter to Trump which stated that the president has “the right to have a Secretary of Defense whose views are better aligned with yours,” and that he would leave his post by the end of February.

But Trump then announced the secretary would be removed from his post on Jan. 1, 2019 — nearly two months before Mattis had planned.

Trump, in October 2018, told CBS News’ “60 Minutes” that he had a “very good relationship” with Mattis, but described him as “sort of a Democrat.”

CLICK HERE TO GET THE FOX NEWS APP

Multiple cabinet officials appointed at the beginning of Trump’s administration in January 2017 have resigned or been removed from their posts and have spoken publicly about their time under the president.

Former Secretary of State Rex Tillerson drew Trump’s ire with criticism of his leadership and relationships with foreign leaders. Trump, in response, blasted Tillerson and has repeatedly called him “dumb as a rock.”

The Associated Press contributed to this report.