Lord Goldsmith has called for an inquiry into how illegal torture techniques came to be used by British soldiers in Iraq.
Lord Goldsmith is the government's chief legal adviser
The Attorney General denied giving army chiefs permission to use sleep deprivation, hooding, stress positions and other techniques on prisoners.
He told MPs he had not been asked for advice on the treatment of detainees.
But he said commanders should have been aware of the Geneva Convention and anti-torture treaties.
He told MPs and peers in a hearing of the Joint Committee on Human Rights: "These techniques were outlawed on a cross-party basis in 1972.
"We have to seek why anyone thought these were permissible techniques. I think there needs to be an inquiry.
"I certainly agree that there is a matter of grave concern as to how these techniques came to be used, who authorised them and on what basis."
He added: "I can't believe that anybody high up in the Army needed to be told, in any event, that our obligations under the Geneva Conventions and criminal law did not permit the treatment of detainees in any way that was degrading or inhuman contrary to Articles 2 and 3 of the European Convention (on Human Rights)."
Lord Goldsmith, who steps down this week after six years, told the committee he was only aware such interrogation techniques had been used after an Iraqi man, Baha Mousa, died in British custody.
Mr Mousa, 26, a hotel receptionist, had been detained under suspicion of being an insurgent. He died in Basra in September 2003.
Seven members of the Queen's Lancashire Regiment (QLR), which is now the Duke of Lancaster's Regiment, faced the most expensive court martial in British history, but all were eventually acquitted.
One soldier, Corporal Donald Payne, 35, became the first British servicemen to admit a war crime, that of treating Iraqi prisoners inhumanely, and was jailed for a year.
But Lord Goldsmith said he had not been asked for advice on the treatment of detainees and if he had he would have told commanders it was "wrong".
"There is a matter of grave concern as to how these techniques came to be used, who authorised them and on what basis and that is a matter which ought to be inquired into," he told the committee.
He added: "It certainly didn't come from my office."
He also denied advising senior officers before the war that the European Convention on Human Rights did not apply on Iraq soil.
He said he had not been aware of e-mails between Rachel Quick, legal adviser to Permanent Joint Headquarters, to the army's senior legal adviser Lieutenant-Colonel Nicholas Mercer, which appeared to suggest otherwise.
"I am not responsible for any of these e-mails. I didn't see them until two or three weeks ago."
He told the committee it was his understanding that Miss Quick had been referring only to the review of detention, rather than the treatment of detainees as a whole.
"From my own point of view, I very much wish she hadn't invoked me in some way, but in relation to the question, whether the UN obligations apply, or the ECHR, in relation to the procedures apply.
"She was right to say in my view, as the court of appeal has said, that it is the UN obligations which trump, not trump, which operate in that specific area."