New Zealand's justice minister Judith Collins has resigned amid a scandal about her ties to a controversial blogger and leaked emails linking her to smear campaigns against rivals.

The resignation of the National party member on Saturday comes just three weeks before New Zealand's general election and could hurt the chances of the prime minister, John Key, returning for a third term in office.

"This has been an extremely distressing and disappointing time," she said at a news conference.

Collins had been under pressure to resign following weeks of revelations linking her to the prominent right-wing blogger Cameron Slater, the son of a former National party president, and smear campaigns against opposition politicians and rivals.

The details were revealed in a book by the journalist Nicky Hager in Dirty Politics, which was based on hacked emails from Slater's Whaleoil blog.

On Friday, details emerged in another leaked email that suggested Collins had been actively involved in an attempt to undermine the head of New Zealand's serious fraud office while she was minister for police.

Key, the prime minister, said the emails raised questions about his minister's judgment.

"This new information suggests Ms Collins may have been engaged in discussions with a blogger in 2011 aimed at undermining the then director of the serious fraud office. Ms Collins was the minister responsible for the SFO at the time."

Collins, known as "Crusher" to her critics, said she would stay on as an MP and campaign for re-election in her North Island constituency.

She strongly denied any suggestion of inappropriate behaviour.

"I am restrained in clearing my name while I am still a minister inside cabinet and I believe the right thing to do is to resign as a minister so I am able to clear my name," she said in a statement.

Source: Al Jazeera and agencies