Prime Minister Malcolm Turnbull has been drawn into a deepening row between the country's two most senior lawyers after he was asked to confirm the government's chief legal adviser ticked off on a controversial bill allowing terrorists to be held in jail beyond their sentence.

Labor wrote to Mr Turnbull late on Sunday seeking his assurance the opinion of Solicitor-General Justin Gleeson, SC, was sought on the bill, which the government had hoped to pass through Parliament before the end of the year.

Mr Gleeson is locked in a public brawl with Attorney-General George Brandis over a legally binding directive Senator Brandis issued before the July 2 election, which prevents ministers seeking Mr Gleeson's advice without the written approval of the Attorney-General.

Legal experts have expressed concern the directive may result in the Solicitor-General, who provides independent advice, being "frozen out" of advising the government and allow the Attorney-General to "shop around" for opinions regarded as politically convenient.