Australia's prime minister says the government has enacted a law that will allow officials to keep convicted terrorists in prison after they have served their sentences.

Malcolm Turnbull said in a statement Friday that the law passed by Parliament on Thursday would keep Australians safe from prisoners convicted of terrorism offenses who continue to pose an unacceptable threat to the community at the end of their sentences.

He says the law is needed because 55 people have been charged in Australia with terrorism offenses since the nation's terror risk was increased to its second-highest level in September 2014.

Sentences can now be extended by court order.