MI5 is not trying to avoid scrutiny by calling for the London bombings coroner to hear top-secret evidence in closed sessions, its lawyers have said.
They said they wanted to make all relevant intelligence available to the coroner even if it revealed failings.
The home secretary wants a judicial review to overturn the coroner's ruling not to exclude victims' families when certain evidence is examined.
The High Court application was heard in the courtroom used for the inquests.
Fifty-two people were killed on 7 July 2005 when four men detonated bombs on London's transport network.
Earlier this month Lady Justice Hallett, the coroner presiding over the inquests into their deaths, ruled that while the public could be excluded in the interests of national security, this did not extend to "interested persons", such as bereaved relatives.
But lawyers for the security service and the home secretary have now argued that the coroner would not be able to reach accurate conclusions without seeing the secret documents, which cannot be revealed in open sessions.
James Eadie QC said: "The security service do consider that there is a quantity of material that cannot be disclosed that is important to a proper understanding of judgements about their conduct."
He said MI5 was seeking a way to make all the information available to the coroner "for good or for ill", recognising that it could be criticised on the basis of the documents.
"This is not an attempt by the security service to avoid or to minimise the scrutiny of their actions by the coroner by citing the need to protect national security," he said.
Mr Eadie said the inquests would be "fundamentally flawed" if the coroner could not consider the highly sensitive intelligence evidence, and could result in her making incorrect findings.
"How could it be in anyone's interests for the wrong lessons to be learned?" he asked.
MI5's position was supported in court by West Yorkshire Police. Its lawyers said says top-secret material was vital to explain why officers did not prioritise Mohammad Sidique Khan who detonated a bomb near Edgware Road Tube station.
Christopher Coltart, representing 26 of the bereaved families, told the court all but one backed MI5's stance on closed hearings.
He said after five years of waiting and anguish they wanted whatever conclusions were reached to be based on the entirety of the evidence.