Australia's prime minister has defended the nation's intelligence agency bosses after a former prime minister described them as "nutters" who have damaged bilateral relations with China.

Former Prime Minister Paul Keating on Sunday urged his center-left Labor Party to clean out the security agency chiefs if Labor wins government at elections next week.

Conservative Prime Minister Scott Morrison on Monday said that Australian security agencies had prevented 15 terrorist attacks in Australia since the national threat level was increased in 2014.

Labor leader Bill Shorten distanced himself from Keating's comments. Opinion polls suggest Shorten will replace Morrison as prime minister after the May 18 election.

Keating was prime minister from 1991 until 1996