NEW DELHI — After a visit from President Obama that was widely seen as a success, India has abruptly removed its highest-ranking diplomat and replaced her with its ambassador to the United States.

The appointment of the ambassador, Subrahmanyam Jaishankar, as foreign secretary, which took effect on Thursday, comes as Prime Minister Narendra Modi steers India toward a closer partnership with the United States. Mr. Jaishankar was a crucial negotiator on the groundbreaking 2008 civilian nuclear agreement between India and the United States, and he was an important interlocutor in coordinating Mr. Obama’s visit.

He replaces Sujatha Singh, who was appointed by the previous government led by the Indian National Congress party, the main rival to Mr. Modi’s Bharatiya Janata Party. Ms. Singh articulated India’s angry reaction to the 2013 arrest of India’s deputy consul general in New York, Devyani Khobragade, on visa fraud charges, an episode that brought relations between the two countries to their lowest point in years.

No explanation was given on Thursday for the reshuffle, which was unusual. The last unceremonious removal of a foreign secretary, Indian news outlets reported, occurred in 1987 under Rajiv Gandhi, then the prime minister.