Former Defense Secretary and retired Marine Gen. Jim Mattis broke an eight-month retreat from the public eye Wednesday with a 2,300-word editorial in The Wall Street Journal that spelled out his decision to serve and later leave the Trump administration. In it, he also warned that infighting is threatening the nation’s democratic ideals.

The piece, Duty, Democracy and the Threat of Tribalism, delves into Mattis' compulsion to serve his country, his leadership philosophy, the events leading up to his 23 months as defense secretary and the divisions he feels are destroying American democracy.

As Mattis tells the story, he flew to New Jersey in November 2016 for an interview with President-Elect Donald Trump but didn't expect to be offered the job, given what he thought were disagreements with Trump on issues such as the torture of prisoners and the NATO alliance.

Citing his cross-country flight's safety briefing on oxygen masks as a metaphor, he felt that, in order to preserve the country's leadership role, it needed to "get its act together first" (putting on an oxygen mask), before helping others (assisting those less capable of putting on their masks).

Related content:

"When the president asks you to do something, you don't play Hamlet on the wall, wringing your hands. To quote a great American company's slogan, you 'just do it,'" Mattis wrote.

The decision took him away from the life he "was enjoying ... spending time with a family [he] had neglected during [his] 40-plus years in the Marines," he wrote.

While the Warrior Monk (a nickname) apparently was not thrilled about returning to Washington, D.C., saying he doesn't draw energy from the "turmoil and politics that animate our capital," he was compelled to answer the call, feeling he could gain bipartisan support for a Defense Department he said was seeing its military advantage erode.

"In the three years since I had left active duty, haphazard funding had significantly worsened the situation, doing more damage to our current and future military readiness than any enemy in the field," he wrote.

As defense secretary, Mattis planned to draw on many of the lessons learned in his 43 years in the Marine Corps, which include adaptation and improvisation, creativity and 100% commitment to the task.

"The Marines' military excellence does not suffocate intellectual freedom or substitute regimented dogma for imaginative solutions. They know their doctrine, often derived from lessons learned in combat and written in blood, but refuse to let that turn into dogma," he wrote. "Woe to the unimaginative one who, in after-action reviews, takes refuge in doctrine."

Mattis remained dedicated to supporting and relying on allies in the conflicts the United States faced, bolstering the Defense Department budget and supporting troops by increasing funds for training and maintenance.

Following the president's lead, he reversed some Obama administration personnel policies, to include reinstituting a ban on transgender persons with gender dysphoria from serving.

But it ultimately was his dedication to alliances that led to his departure. He resigned Dec. 20 in what appeared to be a protest of Trump's orders to withdraw from Syria and his "America First" policy that discounts the value of military partnerships with other nations.

Trump initially said he had accepted Mattis' resignation and wished him well, but later said he asked Mattis to resign, saying he "wasn't happy with what he was doing at all."

In his editorial Wednesday, Mattis reaffirmed his commitment to strategic partnerships. "When you're going to a gunfight, bring all your friends with guns," he wrote. "Nations with allies thrive, and those without them wither."

The departure of a much-admired and respected leader left the Defense Department without a permanent replacement until last month, when former Secretary of the Army Mark Esper was sworn in as defense secretary.

Mattis' book, "Call Sign Chaos: Learning to Lead," is set to be released Tuesday. In it, he reflects on how to lead in a "chaotic world," a riff on his radio call sign when he commanded the 7th Marine Regiment in the 1990s -- CHAOS, which stood for Colonel Has Another Outstanding Suggestion.

He said Wednesday that the nation must overcome its divisions if it wants to remain a global leader, or worse, just survive.

"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. Tribalism must not be allowed to destroy our experiment," he wrote. "On each of our coins is inscribed America's de facto motto, 'E Pluribus Unum' -- from many, one. For our experiment in democracy to survive, we must live that motto."

-- Patricia Kime can be reached at Patricia.Kime@Military.com. Follow her on Twitter at @patriciakime.

Read more from Military.com: