The row began on December 12 when consulate official Devyani Khobragade was arrested on suspicion of filing false documents to obtain a visa for her domestic servant and then underpaying her.
Her arrest outside her childen's school and treatment in custody, when the mother-of-two said she was subjected to a cavity search, outraged India which claimed she benefited from diplomatic immunity.
US prosecutors disputed this because she was a consular official, leading New Delhi to request Washington to grant her a G1 visa given to diplomats at India's UN mission which is also in New York.
"Devyani given G1 visa by USA according her full diplomatic immunity. India transfers her back. She is now flying home," Indian foreign ministry spokesman Syed Akbaruddin said in a tweet that confirmed the deal.
Just hours earlier, prosecutors had filed charges against her in a New York court.
The deal ends the dispute, but the two countries which had embraced each other as strategic partners must now count the cost of weeks of feisty exchanges which have left resentment on both sides.
India has removed extra security barriers at the US embassy in New Delhi, has demanded contract details for domestic staff employed by American diplomats and even stopped the mission importing duty-free alcohol.
On Wednesday, it ordered an embassy leisure center popular with American expatriates in the capital to stop admitting non-diplomatic members, while scheduled visits by US officials to India have been cancelled.
The United States through presidents George W. Bush and Barack Obama has invested heavily in improving ties with India which it has embraced as part of its "pivot" to Asia, designed to check Chinese influence.
India has benefited from US backing to gain access to foreign nuclear energy technology and Washington has become an important arms supplier and key market for India's software and IT services exports.
The row exposed a gulf in perceptions and values between the two countries.
Khobragade, a wealthy 39-year-old, was seen at home as the victim of heavy-handed policing and her treatment was viewed as a humiliation of a India by the world's superpower.
Domestic servants are routine for the middle classes in India where few employees have contracts, many are abused, and none make even a fraction of the US minimum wage.
In the United States, there was little public sympathy for a woman allegedly exploiting a vulnerable employee who had lied to bring her to the country.
"We are proud Indians. We may be a poor country but we don't compromise the sovereignty of the country," Khobragade's father, Uttam, told a press conference on Friday.
"We as a family would not like to touch the soil of a country that treats a human being in such a way," he added, saying that Khobragade's children and American husband would follow her to India.
In New York on Thursday, Preet Bharara, the US attorney for the southern district of the city, informed a judge that a grand jury had filed two counts of visa fraud and making false statements against Khobragade.
In an indictment, the grand jury said Khobragade had contracted to pay her servant 30,000 rupees ($573) a month – double the wages she would probably earn in India, but lower than the minmum wage in the US.
In the alleged fake contract shown to US authorities, Khobragade listed a monthly pay of $4,500 for her maid.
The indictment also accused Khobragade of forcing the servant to work for illegally long hours, initially 7 days a week, before she was given off part of Sunday.
Khobragade did not give the servant any days off for holidays, vacation or illness, telling her not to fall sick because of the cost of seeing a doctor, the indictment said.
A statement from the Indian foreign ministry on Thursday read: "At the time of her departure to India, consular Khobragade reiterated her innocence of charges filed against her."
US prosecutors said they extended courtesies to Khobragade but that a strip search – unthinkable in India against an educated woman – was standard practice for anyone taken into custody.
US Secretary of State John Kerry has voiced regret over Khobragade's treatment. But he did little to temper the row, with Indian Foreign Minister Salman Khurshid vowing not to stop until he restored the "dignity" of Khobragade. – Rappler.com