3M has agreed to import millions of protective masks for U.S. health-care workers after falling into a dispute with the Trump administration about shortages of the critical protective wear, President Trump and the company said Monday.

3M, based in Minnesota, said it will import 166.5 million masks over the next three months, mostly from its factory in China.

Trump last week invoked the Defense Production Act in relation to 3M, saying he was not happy with the company’s delivery of N95 masks to U.S. health-care workers fighting the novel coronavirus. The DPA order required 3M to prioritize orders from the federal government.

At a briefing Monday, Trump said he had resolved things with the manufacturing giant after speaking with 3M chief executive Michael Roman.

“We have reached an agreement, a very amicable agreement, with 3M for the delivery of an additional 55.5 million high-quality face masks each month, so that we’re going to be getting over the next couple of months 166.5 million masks for our front-line health-care workers,” Trump said. “So the 3M saga ends very happily.”

3M was already making 35 million N95 masks a month in the United States, mostly for the U.S. market. But hospitals have still grappled with shortages of protective equipment.

3M said it exports a “small proportion” of its U.S. production to Canada and Latin America. Last week, the company said the Trump administration had asked it to stop those exports, to make more masks available for U.S. use. That prompted complaints from Canadian Prime Minister Justin Trudeau.

On Monday, 3M said its new deal with the Trump administration “will also enable 3M to continue sending U.S. produced respirators to Canada and Latin America, where 3M is the primary source of supply.”

3M’s factory in China has largely produced masks for the Chinese and Asian markets. In February, presidential trade adviser Peter Navarro complained in an interview with Fox Business that China had moved to “nationalize, effectively, 3M, our company . . . to prevent them from sending us any stuff.”

In its statement Monday, 3M said the White House has “committed to working to address and remove export and regulatory restrictions to enable this plan.”

3M makes N95 masks for two uses — medical and industrial. Both types filter at least 95 percent of airborne particles, but they vary in design and fit. Last month, the Food and Drug Administration issued an emergency order allowing the sale of industrial masks to health-care users, as a way to ease the shortages.

3M didn’t respond to a request for comment about whether the masks to be imported from China were designed for industrial or medical use.