(CNN) Australia's Deputy Prime Minister Barnaby Joyce said Friday he will resign following weeks of controversy after he announced he was expecting a baby with a former staff member.

Earlier in February, Joyce had admitted to the affair, confirming long-running rumors, but refused to resign saying it was a private matter.

Then on Thursday, the National Party said it had received a separate, formal complaint against its leader , accusing him of sexual harassment, Australia's national broadcaster ABC reported.

CNN contacted the National Party but didn't receive an immediate response. The Nationals govern in a coalition agreement with the Liberal Party led by Prime Minister Malcolm Turnbull.

Speaking to journalists, he said he was resigning from his role as leader of the National Party, to put aside "this current cacophony of issues" and avoid further harassment of his family and partner.

Read More