British Prime Minister David Cameron used a rare address to the Australian Parliament on Friday to call for extremist preachers to be banned and for extremism to be rooted out of schools, universities and prisons.

Britain and Australia have both sent their militaries to fight in a U.S.-led coalition against Islamic State extremists in northern Iraq. They have also both had radicalized citizens leave to join terrorists fighting in Iraq and Syria.

Cameron told the Parliament the root cause of extremism was not poverty, social isolation from the mainstream or foreign policy.

"The root cause of the challenge we face is the extremist narrative. So we must confront this extremism in all its forms," Cameron said.

"We must ban extremist preachers from our country. We must root out extremism from our schools, universities and prisons," he said.

Removing extremist material from the Internet posed a pressing challenge, he said. The British government was pushing Internet providers to strengthen filters, improve reporting mechanisms and become more proactive in taking down such material.

Australia recently passed counterterrorism laws that give law enforcement authorities more power to prevent Australians from joining the extremist fighters and to prosecute those who return.

Cameron briefly outlined proposed legislation in Britain aimed at preventing terror suspects from traveling, including cancelling their passports while they were overseas.

At a news conference later, Cameron defended a measure that would prevent British terror suspects from returning to the country.

"Successive governments have come to the view — and I agree with the view — that when you're facing an existential challenge as great as the one we face with Islamist extremists, you need additional powers as well as simply the criminal law," Cameron told reporters.

Cameron visited Canberra ahead of attending the G-20 weekend summit of leaders of wealthy and developing countries in the east coast city of Brisbane.