Prime Minister Malcolm Turnbull has accused Labor of putting national security at risk as it steps up its attack on Attorney-General George Brandis over his public brawl with the government's chief legal adviser.

Shadow attorney-general Mark Dreyfus wrote to Mr Turnbull late on Sunday seeking his urgent assurance that Solicitor-General Justin Gleeson, SC, had advised on a controversial bill allowing convicted terrorists to be held in jail beyond their sentence.

Mr Gleeson and Attorney-General George Brandis are at loggerheads over a legally binding direction Senator Brandis issued before the July 2 election preventing ministers, including Mr Turnbull, from seeking Mr Gleeson's advice without the Attorney-General's written permission.

Mr Dreyfus has led the opposition's attack on Senator Brandis over the direction, which has been criticised by legal experts as posing a risk to the independence of the Solicitor-General.