CANBERRA, Australia -- Australia's prime minister has banned government ministers from having sex with staff as his deputy battles for his political survival over revelations that he is expecting a baby with a former press secretary.

Prime Minister Malcolm Turnbull on Thursday accused Barnaby Joyce of making a "shocking error of judgment" by having an office affair which had hurt his wife, his four daughters and his new partner who is due to give birth in April.

Deputy Prime Minister Barnaby Joyce during House of Representatives question time at Parliament House on October 25, 2017 in Canberra, Australia. Getty

Since news of the impending birth broke last week, Turnbull has supported Joyce and declined to comment on his personal circumstances out of respect for his estranged wife of 24 years and children.

Get Breaking News Delivered to Your Inbox

Turnbull said Joyce will not serve as acting prime minister when Turnbull visits the United States next week.