Defense Secretary-nominee James N. Mattis, a retired Marine Corps general, listens to a question on Capitol Hill in Washington while testifying at his confirmation hearing before the Senate Armed Services Committee on Jan. 12, 2017. (J. Scott Applewhite/AP)

Gen. James N. Mattis seemed financially set when he retired in 2013 after more than 41 years in the Marine Corps. He was in line for an annual federal pension of more than $230,000, and a book contract was on the horizon.

But Mattis soon demonstrated the enduring power of the military-industrial complex, as another retired general — President Dwight D. Eisenhower — famously called it.

Mattis joined the board of the nation’s fourth-largest defense contractor, General Dynamics, which paid him $276,000 in fees for his work, according to the most recent financial filings with the Securities and Exchange Commission. He also has a little more than $1 million in General Dynamics stock and options (based on Wednesday’s stock price), some of which he cannot cash in yet, according to Equilar, an executive and board-data provider.

Donald Trump ran for president on the theme of draining “the swamp” of Washington, a metaphor for doing battle with entrenched interests. But in Mattis, he has selected a defense secretary who embodies the revolving-door culture of Washington that Trump promised to end. Mattis has said he will forfeit or divest his various stock holdings. Last week, as he sailed through his confirmation hearing, not one senator asked him about his work with General Dynamics, or his time on the board of blood-testing company Theranos, where he was paid at least $150,000 in a period when the company’s labs and core technology were being questioned.

“It would be rare to find any senior retired military officer who is not connected in some way to a military contractor,” said Christopher Preble, vice president for defense and foreign policy at the libertarian Cato Institute. But, Preble said, “the fact that it did not come up in the hearing is disappointing. I think he should have been compelled to explain how he will comply with the ethics rules.”

Mattis will enter the Pentagon at a time when Trump has suggested increasing spending there by billions of dollars, a boon to defense contractors, including Mattis’s former employer. The company’s 2015 revenue was $31.5 billion, more than half of it from the federal government.

Allison Marre, a Mattis spokeswoman, said in an email that he has received a thorough briefing about the ethics rules and will abide by the one-year restriction against involving himself in decisions regarding General Dynamics. Mattis “has always fully complied with both the letter and the spirit of federal ethics laws and regulations,” Marre said. Asked whether a one-year restriction is long enough, she said, “The cooling off period is implemented precisely to avoid any suggested conflicts of interest.”

Lucy Ryan, a General Dynamics spokeswoman, said the company will comply with all ethical guidelines set by the government.

Mattis said during his hearing that he had been “enjoying a full life west of the Rockies” and did not anticipate being nominated to run the Pentagon. He accepted a fellowship with Stanford University’s conservative Hoover Institution, and received more than $420,000 combined in the past two years. In addition to his paid positions, he made more than $150,000 after retirement in speeches to companies including Goldman Sachs and the defense firm Northrop Grumman.

Mattis joined the board of General Dynamics in August 2013. The company said in 2016 that his “demonstrated leadership and strategic skills make him well-equipped to advise on strategic opportunities and risks associated with our aerospace and defense businesses.”

General Dynamics’ most significant contract is for the Columbia-class submarine, a centerpiece of the Navy’s future. Twelve of the vessels have been commissioned at more than $2 billion each, and construction of at least 16 more submarines has been approved. The company also sells the Pentagon an array of equipment including main battle tanks for the Army and destroyers for the Navy.

The outgoing defense secretary, Ashton B. Carter, resigned from positions with two firms in Silicon Valley after he was nominated to run the Pentagon in late 2014. He signed an agreement to avoid working with the companies directly for two years but pushed the Pentagon more broadly to pursue ties in the technology hub.

Dan Grazier, a fellow at the independent government watchdog Project On Government Oversight, said that while Mattis’s private work is not an “absolute disqualifier,” it is “troubling, and we want to make sure that all the regulations and laws are followed to the letter.” In particular, Grazier said, Mattis will need to avoid appearances that could be construed as favoritism when it comes to the Columbia-class submarine.

But Arnold Punaro, a retired two-star Marine Corps general and member of the Pentagon’s Defense Business Board, said that with Mattis resigning from the General Dynamics board and divesting his stock in the company “it would be hard to make a case that there is a conflict” of interest. As defense secretary, Mattis will not have any continuing financial interest in General Dynamics, Punaro noted. Any question about Mattis’s connections to the company, he said, are “a perception issue at best.”

Mattis’s work for the blood-testing firm Theranos has raised a different set of concerns — whether he did anything when troubles arose at the firm other than receive a paycheck that amounted to $150,000 in 2015 and an undisclosed amount for 2013, 2014 and 2016.

Mattis was the head of U.S. Central Command in 2011 when he met an entrepreneur who had founded the blood-testing company. Elizabeth Holmes, a Stanford University dropout, more than three decades younger than Mattis, had big ideas about how her technology — a rapid, finger-stick blood test — could transform health care. Theranos imagined that its technology could have military uses, too, allowing medics to quickly run blood tests on wounded soldiers.

Holmes targeted Mattis to get support, sending him a message June 12, 2012, about the company’s regulatory certifications, according to emails obtained by The Washington Post.

Mattis responded that he was enthusiastic to see the blood-testing technology demonstrated in the field.

“I’ve met with my various folks and we’re kicking this into overdrive to try to field your lab in the near term,” Mattis wrote. “Again, my thanks for what you’re doing and for your willingness to work with us on this. I’m convinced that your invention will be a game-changer for us and I want it to be given the opportunity for a demonstration in-theater soonest.”

That summer, Mattis got a demonstration of the Theranos technology in California.

Meanwhile, a military regulatory and compliance official, Lt. Col. David Shoemaker, had met twice with Theranos as part of the process to vet the technology, according to internal emails and a white paper obtained by The Post. Shoemaker saw problems with the company’s regulatory strategy and got feedback from regulators that they also had concerns.

Holmes complained in an email to Mattis that Shoemaker had “communicated blatantly false information about our company” and asked Mattis to assist in getting the facts straightened out with regulators.

Mattis forwarded the email internally, apparently frustrated by the delay in getting the battlefield demonstration going and asking what was going on.

“I have tried to get this device tested in theater asap, legally and ethically, and I need to know did this visit happen as related below and how do we overcome this new obstacle,” Mattis wrote.

In August 2012, Shoemaker traveled with the director of the office of in vitro diagnostics at the Food and Drug Administration to Tampa, where Central Command is based, to meet with Mattis and explain the regulatory problems with Theranos’s approach. The general was “disappointed that it has been almost a year since he first told his staff to make it happen,” according to the executive summary describing the meeting.

Shortly after Mattis retired from the military, he joined Theranos’s board, serving alongside other senior statesmen and people with military expertise. Members included two former secretaries of state, Henry A. Kissinger and George P. Shultz, former U.S. senator Sam Nunn and former secretary of defense William J. Perry.

At first, while Mattis was on the board, Theranos was a darling of investors and was valued at $9 billion. Holmes was featured on the covers of Forbes, Fortune and Inc. magazines, and she was compared to Apple co-founder Steve Jobs. She talked about how her technology could help start a revolution in health care in which consumers could seek out their own health information in a cheap and transparent way.

The company remained secretive about how its technology worked. A Wall Street Journal investigation in 2015 raised questions about whether its proprietary technology was being used for most of its tests, and whether the technology was accurate.

Since then, regulators uncovered a slew of compliance problems. Holmes was banned from owning or operating a clinical laboratory for two years — a decision the company has said it is appealing. Theranos has corrected test results, shut down its clinical labs and been slapped with lawsuits that it has said have no merit. The company is under investigation by the U.S. attorney for the Northern District of California and by the Securities and Exchange Commission, according to the Wall Street Journal.

Throughout it all, Mattis’s role was a mystery, given that he was working with a private company. He remained on the board until December, when Trump nominated him to run the Pentagon. He has not said why he stayed with the company as it came under review by regulators, or whether he had any role in the problems or in seeking solutions.

Marre, the Mattis spokeswoman, said that “like any effective leader, General Mattis did not quit when allegations arose and instead worked with fellow board members to identify solutions.” Asked what Mattis did, she said “directors cannot legally discuss board conversations” and referred questions to Theranos.

The company declined to answer questions about the board’s roles and responsibilities. But as Theranos faces lawsuits, including one from a major investor, questions about Mattis’s role may become an issue.

“Our discovery [process] will also include what the board of directors knew and when they knew it and what they’ve done about it,” Reed Brodsky, a partner at Gibson, Dunn & Crutcher who represents Partner Fund Management, a private investment firm that is suing Theranos, said during proceedings related to the lawsuit, according to a transcript.

Theranos said on its website that the suit is “without merit.”