Queensland’s attorney-general has won his fight to keep a notorious killer and rapist behind bars.

A notorious killer and rapist who has been in jail for more than 30 years will remain there after Queensland’s attorney-general successfully appealed against his release.

Mark Richard Lawrence, 52, was to have been released from prison in early May after doing time for the 1983 manslaughter of a female psychiatric patient and the 1999 rape of a fellow inmate.

Supreme Court justice Philip McMurdo decided he wouldn’t be a danger to the community if he was released under strict supervision.

Attorney-General Jarrod Bleijie appealed that decision.

The Court of Appeal on Tuesday ruled Justice McMurdo made an error in his initial ruling and ordered Lawrence’s detention order to continue.

In his written judgment, Justice Robert Gotterson said no supervision order would prevent Lawrence from experiencing sadistic sexual fantasies like the ones that triggered his previous offending.

He said Justice McMurdo had made a mistake by assuming Lawrence was telling the truth when he told psychiatrists he was no longer experiencing fantasies.

“No provision of a supervision order could provide a reliable means of ensuring that the development of such fantasies upon which … (Lawrence) might act could be detected after the respondent was released,” Justice Gotterson wrote.

“The consequences of the realisation of the risk of reoffending were potentially of the utmost seriousness.

“Only a continuing detention order could adequately protect the public.”

Lawrence was given the continuing detention order, which is periodically reviewed, in October 2008.

Mr Bleijie welcomed the ruling, saying the government made a commitment to make Queensland the safest state in Australia to raise a family.

“Mark Richard Lawrence’s violent history spans three decades, including manslaughter, rape and escape from custody,” Mr Bleijie said in a statement.