Ford is beating a retreat from India’s large but struggling car market.

The US carmaker will transfer most of its Indian business to a new joint venture controlled and managed by local rival Mahindra, it announced on Tuesday. Mahindra will own 51% of the joint venture and Ford the rest.

The joint venture should be operational by the middle of 2020. It will “develop, market and distribute” Ford vehicles in India and also sell Ford and Mahindra vehicles overseas, the company said.

In August, Mahindra said North Carolina is on the list of five states being considered for a new manufacturing plant in the United States. And in its announcement the company said it is looking for tax incentives.

Legislation passed in 2018 as North Carolina sought big projects such as Amazon HQ2 as well as an Apple campus and after losing out on other auto industry projects offers companies the chance to get rebates on personal income withholdings paid to employees for two decades or more.

Ford and Mahindra have been working together in India since 2017, when they formed a “strategic alliance” to focus on technologies like smart and electric vehicles.

Ford first began operations in India in 1995 and has invested more than $2 billion in the country over the last 25 years. The company has two plants in the western state of Gujarat and the southern state of Tamil Nadu, which produce cars for India as well as other markets.

Indian vehicle manufacturer puts NC on shortlist for new $1B plant, 2,000 jobs

It became the first American carmaker to import vehicles from India, announcing in 2016 that it would start shipping its EcoSport compact SUVs from its Tamil Nadu plant to the United States.

Ford’s exit is more evidence of the immense pressure on India’s auto industry, which has been struggling as consumers hold off on big purchases because of a credit crunch and a slowing economy. Car sales in India plunged 41% in August compared to the same month last year, marking the biggest monthly drop in two decades and a tenth straight month of declines.

Commerce exec: NC would be ‘excellent choice’ for auto industry – Here’s what Mahindra could be offered

India had been a bright spot in the global car industry, with annual sales of passenger vehicles rising 33% in the last five years. Before this year’s slump hit, it was predicted to overtake Germany and Japan to become the world’s third largest car market by 2020.

Ford is in the middle of an overhaul of its global operations. It announced a $11 billion restructuring plan in July last year that it says will help it transition to newer technologies such as electric and self-driving vehicles. It has already slashed thousands of jobs worldwide, and announced plans to close down plants in Russia, France and Brazil.