Ford Motor Co. ’s decision to stop making cars in India deals a blow to Prime Minister Narendra Modi’s domestic manufacturing drive while highlighting the difficulty foreign auto makers have gaining a foothold in the market.

On Thursday, Ford said it would shut manufacturing operations in Sanand, in the western state of Gujarat, and in the southern city of Chennai after accumulating more than $2 billion in losses during the past 10 years. It cited weaker-than-expected demand for its new vehicles.

Chief Executive Jim Farley called the move difficult but necessary to stay profitable and focus on growth. Ford said its closures would affect 4,000 jobs.

Ford and most other Western auto makers have found it difficult to stake a claim in India’s passenger-vehicle market, which is dominated by the smaller, budget-friendly passenger cars produced by the Indian units of Japan’s Suzuki Motor Corp. and South Korea’s Hyundai Motor Co. Together those two companies account for 60% of new car sales.

Although Ford has been in India for three decades, its market share last month amounted to 1.4%, according to India’s Federation of Automobile Dealers Associations. Rivals Renault SA, Honda Motor Co. and Nissan Motor Co. fared little better, each holding a share of less than 3%.

Ford’s decision to shut its production plants in India is the latest setback to Prime Minister Modi’s “Make in India” initiative, as the country’s economy tentatively recovers from a deep recession induced by the coronavirus pandemic.

Mr. Modi started the campaign soon after he came to power in 2014. When Ford announced its production plant in Gujarat in 2011, Mr. Modi was the state’s chief minister.

Ford said the plant closures would affect 4,000 jobs in India.

Photo: anushree fadnavis/Reuters

“Gujarat is proud to host the biggest facility of Ford outside America worth $1 bn which will provide a total of 36,000 jobs,” he wrote on Twitter at the time.

Gopal Krishna Agarwal, a spokesman for Mr. Modi’s Bharatiya Janata Party, said the Indian car market was highly competitive and Ford was to blame for its troubles.

“Ford’s choice of product was not suitable to Indian conditions, and their after-sales service was also poor,” Mr. Agarwal said. Other auto makers are doing well and overall industry growth is satisfactory, he said.

Ford’s decision follows exits by General Motors Co. , MAN Truck & Bus SE of Germany and Harley-Davidson Inc. since 2017. Toyota Motor Corp. last year blamed high taxes for a decision to halt its expansion in India. India’s automotive industry entered a decline in 2019, a slowdown that has been exacerbated by the pandemic.

The Indian dealer federation said Ford’s move would directly affect 170 dealers who have invested more than $270 million in setting up the company’s dealerships and together employ around 40,000 people.

Write to Krishna Pokharel at krishna.pokharel@wsj.com and Philip Wen at philip.wen@wsj.com

Corrections & Amplifications
Indian Prime Minister Narendra Modi’s first name was misspelled as Narenda in the photo caption in an earlier version of this article. (Corrected on Sept. 10)