A court in northern India has ordered the son of a leading politician into police custody for harassing and trying to abduct a woman after a media uproar.

The court in the city of Chandigarh, the capital of Haryana state, sent Vikas Barala, son of Subhash Barala, president of the Bharatiya Janata Party (BJP) in Haryana state, and an associate to two days' custody on Thursday.

They were first arrested last weekend after 29-year-old Varnika Kundu alleged that they tried to force open the door of the car she was driving home.

The police released the pair within hours and charged them with stalking and drunk driving instead of the attempted kidnapping charge requested by Kundu.

Women's rights campaigners protested the move and the opposition accused Subhash Barala of putting pressure on the police to drop the harsher charge.

READ MORE: Chandigarh stalking - Haryana police accused of cover-up

Kundu, in a widely shared Facebook post, said she was "lucky because I'm not lying raped and murdered in a ditch somewhere".

One BJP leader on Monday blamed the victim for being out late, triggering a backlash on social media and prompting the party to distance itself from such comments and say the law would take its course.

Indian women posted selfies of themselves out at night on social media under the hashtag #AintNoCinderella.

The case has embarrassed the BJP as it runs a campaign on women's safety.

The opposition Congress Party this week accused the BJP, which runs both Haryana and the federal government, of shielding Vikas and mocked Prime Minister Narendra Modi's campaign to "save the girl child, educate the girl child".

Bir Kumar Yadav, the BJP spokesman in Haryana, denied there had been any attempt to influence the investigation and rejected calls from congress to sack Subhash Barala as state party chief.

Barala could not be reached for comment.

"There's no political influence to dilute the case. It's an individual incident with no links to the party or its campaign on safety for women," Yadav said.

Haryana has one of most unbalanced sex ratios in the country because of a high rate of abortion of female foetuses.

Modi launched the national programme to "save the girl child" in 2015.

Scrutiny of sexual violence has grown in India since the 2012 gang rape and murder of a student in New Delhi.