SAN JOSE — Former defense secretary Jim Mattis took the stand Wednesday at the fraud trial of entrepreneur Elizabeth Holmes, saying he was under the impression for years that Theranos was capable of running thousands of tests on its own devices.

Mattis said he would have had a different view of the company if he had known some limitations of the Theranos blood-testing device, including that it could run only about a dozen tests on its own system, could process only a certain type of blood test and was relying heavily on third-party machines, as prosecutors have alleged.

“It would have tempered my enthusiasm significantly,” he said in response to a prosecutor’s questions Wednesday about the use of third-party devices. Mattis served on the company’s board from summer 2013 to fall 2016.

Mattis’s testimony is key to the prosecution’s case in one of the most closely watched corporate fraud trials in years. Holmes, the former CEO of blood testing start-up Theranos, is charged with 10 counts of wire fraud and two counts of conspiracy to commit wire fraud. Federal prosecutors have alleged that she misled investors and patients about the capabilities of her company’s blood-testing devices.

Holmes formed Theranos when she was a 19-year-old Stanford University student in 2003 and grew it into a company with hundreds of employees over the next 15 years. But the company collapsed in 2018 after media and regulatory investigations cast doubt on its ability to run multiple tests from a few drops of blood drawn from the fingertip.

Holmes has pleaded not guilty. She faces up to 20 years in prison and up to a $3 million fine if she is convicted.

Mattis, who served as defense secretary for two years beginning in 2017, said earlier he met Holmes in roughly 2011 and began discussing how the military could use the technology, according to a report in the Wall Street Journal. He later invested $85,000 of his own money in the company, an amount he said was significant to him.

He said during testimony Wednesday afternoon that he served on the company’s board, saying he was striving to offer help and guidance to Holmes. To his knowledge, Theranos’s technology was never used by the military, he said.

His impression of the company began to change when the Wall Street Journal reported in 2015 that employees inside the company were worried that Theranos devices were giving inaccurate blood test results, he said.

It became clear to him that the company might have a reputation image issue, he said.

“I thought all along that we were doing it on Theranos gear,” he said to prosecutors. “And I’m a member of the board and I thought that.”

During cross-examination, the defense attempted to show how fervently Mattis supported the company. Mattis said the company was under attack after the Journal article and needed to respond.

The defense questioned Mattis on his understanding of the company’s capabilities and confirmed that he was familiar with the board’s statement supporting Theranos in the wake of negative media about the company.

In an email sent to Holmes after the Journal’s article, Mattis said he had faith in the plan. He told defense lawyers he supported Holmes’s suggestions in the response to the Journal’s investigation that the company could consider releasing data it had sent to regulators and invite people in to take blood tests.

“I thought it was a step in the right direction,” he said. “It was time to stand and deliver.”

Mattis left the board in December 2016 when he learned he would be interviewed to potentially become secretary of defense.