In late November 2016, I was enjoying Thanksgiving break in my hometown on the Columbia River in Washington state when I received an unexpected call from Vice President-elect Mike Pence. Would I meet with President-elect Donald Trump to discuss the job of secretary of defense?

I had taken no part in the election campaign and had never met or spoken to Mr. Trump, so to say that I was surprised is an understatement. Further, I knew that, absent a congressional waiver, federal law prohibited a former military officer from serving as secretary of defense within seven years of departing military service. Given that no waiver had been authorized since Gen. George Marshall was made secretary in 1950, and I’d been out for only 3½ years, I doubted I was a viable candidate. Nonetheless, I felt I should go to Bedminster, N.J., for the interview.

I had time on the cross-country flight to ponder how to encapsulate my view of America’s role in the world. On my flight out of Denver, the flight attendant’s standard safety briefing caught my attention: If cabin pressure is lost, masks will fall…Put your own mask on first, then help others around you. In that moment, those familiar words seemed like a metaphor: To preserve our leadership role, we needed to get our own country’s act together first, especially if we were to help others.

The next day, I was driven to the Trump National Golf Club and, entering a side door, waited about 20 minutes before I was ushered into a modest conference room. I was introduced to the president-elect, the vice president-elect, the incoming White House chief of staff and a handful of others. We talked about the state of our military, where our views aligned and where they differed. Mr. Trump led the wide-ranging, 40-minute discussion, and the tone was amiable.

Afterward, the president-elect escorted me out to the front steps of the colonnaded clubhouse, where the press was gathered. I assumed that I would be on my way back to Stanford University’s Hoover Institution, where I’d spent the past few years doing research. I figured that my strong support of NATO and my dismissal of the use of torture on prisoners would have the president-elect looking for another candidate.