“Since various media outlets raised serious questions regarding my character, I hereby resign from my position on moral grounds to ease an independent, free and fair investigation until the investigation process completes,” Mr. Mahara said in a written statement.

Such swift action is unusual in Nepal, where the #MeToo movement against sexual harassment has struggled to gain ground.

The Nepali news site Hamrakura.com published an interview with the accuser on Monday, which led to calls by opposition parties and the public for an independent investigation of her claims and demands that Mr. Mahara step aside at least temporarily.

According to local news accounts, the woman said that Mr. Mahara had tried unsuccessfully for years to force himself upon her. She said that on Sunday evening, when her husband was away, Mr. Mahara came to her apartment with whiskey and snacks. As his security guards waited outside, she said, he forced her to drink liquor and then raped her. When she tried to resist, she said, he beat her.

The woman did not respond to requests for comment on Tuesday.

Mr. Mahara, a former Maoist rebel leader who served as a government minister multiple times, has been an important leader in Nepalese politics. He led the team of Maoist negotiators who cut a deal with the government in 2006 to end the insurgency and bring the Maoists into mainstream politics.