Controversial changes to national security legislation to protect Australia against espionage threats have received overwhelming support in Parliament's lower house.
Just two MPs - independent Andrew Wilkie and the Greens' Adam Bandt - voted against changes they claimed the government and opposition were trying to rush through pegged on political self-interest before by-elections next month.
"The practices of modern espionage are now being encountered in so many western democracies around the globe," Attorney-General Christian Porter told parliament.
After initial opposition, Labor sided with the government to allow the legislation to pass through the lower house on Tuesday afternoon.
Shadow attorney-general Mark Dreyfus said amendments, from recommendations by parliament's security and intelligence committee, had mostly addressed concerns around criminal sanctions for journalists reporting on national security and others.
"Clearly these outcomes would have been completely unacceptable to most Australians and it's concerning that the prime minister thought these measures, and others of a similar nature, were acceptable," he said.
Related legislation to secure a register for people acting on behalf of foreign governments, political organisations or individuals was also supported after the scope was narrowed to exempt media organisations, charities, arts and cultural organisations and trade unions.
Mr Wilkie, a former senior intelligence officer, told parliament he believes the proposed laws are poorly crafted and will unnecessarily diminish civil rights.
He said it was "absolute rot" that laws had to be in place ahead of five by-elections to be held on July 28.
"We should look at these things carefully and slowly and ultimately what this place passes is in our national security's best interest and not in the political best interest of a government or opposition," he said.
Mr Bandt said the laws would take Australia further down the road of becoming the type of society the foreign interference laws are meant to protect the country from.
Amnesty International has supported exemptions for charities but continues to have concerns around accountability for human rights.
The bills will now go to the Senate.