Ford Motor Co. said Tuesday it is scrapping plans for a new $1.6 billion assembly plant in Mexico, instead choosing to build small cars in an existing Mexican factory, and invest $700 million in a Michigan facility that will build electric vehicles.

The move is a surprising turnaround for Ford F, +1.03%   after facing criticism by President-elect Donald Trump for more than a year in relation to its Mexico plan. Last month, Chief Executive Mark Fields said it was looking to work with the incoming administration on Trump’s trade agenda, but indicated it was too late to change its specific plan to build a new factory in Mexico.

The announcement comes just hours after Trump criticized Ford rival General Motors Co. GM, +0.89%  for sending some of its Chevrolet Cruze production from Mexico to U.S. dealerships and paying no taxes. Trump has used the auto industry as an example of why the North American Free Trade Agreement needs to be retooled.

In a press release, Ford said it is canceling the plan for a factory in San Luis Potosi and will instead build its Focus small car in an existing facility in Hermosillo, Mexico. The Focus is currently built in Wayne, Mich., and Ford has said new products are slated for that plant but hasn’t identified specific nameplates.