SYDNEY (Reuters) - The leader of the opposition in Australia’s most populous state resigned on Thursday after he was embroiled in a #MeToo row when a female reporter released a statement detailing alleged inappropriate behavior.

New South Wales (NSW) state Labor party leader Luke Foley denied allegations made by an Australian Broadcasting Corp (ABC) journalist but said he was resigning as party leader, four months before a state election he had been in a position to win.

“I can’t fight to clear my name and fight an election at the same time, its just not possible to do both. Therefore I am resigning the leadership effective today,” Foley told reporters in Sydney.

Foley said he had hired lawyers and would launch legal action for defamation. He declined to answer any questions.

Earlier on Thursday, the ABC issued a statement from one of its journalists that detailed alleged misconduct by Foley at a Christmas function in Sydney in 2016, in which she said she was forced to go public because the issue was raised in parliament.

Harassment allegations were first raised by a government minister in parliament on Oct. 18.

The reporter, Ashleigh Raper, said in her statement that she never wanted the issue to go public.

“It is clear to me that a woman who is the subject of such behavior is often the person who suffers once a complaint is made,” Raper said in her statement.

“I cherished my position as a state political reporter and feared that would be lost. I also feared the negative impact the publicity could have on me personally and on my young family.”

Raper said she issued the statement because she wanted harassment of women to stop, for politicians to stop using such incidents for “political point scoring”, and to get on with her life.

The ABC, which ran Raper’s statement in full, said it had discussed with her the alleged incident earlier this year and had adhered to her request to keep it private.

“The ABC considers it extremely unfortunate that media and public pressure has been applied to Ms Raper during these past months and caused her to speak publicly on an issue she did not wish to pursue or to comment on,” the ABC said in its statement.

Despite Foley’s resignation, the scandal is likely to dent Labor’s chance of winning power in Australia’s largest state in the March 23 election.

A ReachTel poll in September had Labor and the ruling conservative coalition running neck-and-neck in the state.

“The polls are so tight. Labour can ill-afford this episode less than five months out from the next election,” Peter Chen, political science professor at the University of Sydney, said before the resignation.

The NSW economy accounts for one-third of Australia’s gross domestic product and at $400 billion is larger than the economies of Thailand, Malaysia and the Philippines.