MI5 faces having to disclose secret documents to the families of those killed in the 7/7 bombings after a coroner ruled she could not hear confidential evidence in closed sessions.
Lady Justice Hallett rejected calls for the bereaved relatives to be excluded from hearings so she could examine intelligence material so sensitive it would threaten national security if made public.
The father of one of the victims of the atrocities welcomed her ruling, saying it would make it more difficult for MI5, also known as the Security Service, to hide from scrutiny.
The coroner previously ordered that the inquests for the 52 innocent people murdered in the July 7 2005 suicide attacks on London should examine alleged failings by police and MI5.
The bereaved families want to ask intelligence officials why they did not follow up plot ringleader Mohammed Sidique Khan and his right-hand man, Shehzad Tanweer, after surveillance officers watched them meeting known terror suspects 17 months before the bombings.
Lawyers for MI5 and the Home Secretary argued that Lady Justice Hallett, an appeal court judge appointed to hear the inquests, should receive secret intelligence material in closed hearings excluding the families.
But she ruled today that she had no power to deny the bereaved families their "rights" to see and hear the evidence.
The coroner said the secret files could be edited to remove names of sources and other confidential information.
"I am still hopeful that with full co-operation on all sides, most if not all of the relevant material can and will be put before me in such a way that national security is not threatened," she said.
In her ruling she referred to the terror plot foiled when explosives were found on a cargo plane at East Midlands Airport on Friday as an example of the pressures on the intelligence agencies.
"I am all too aware, given the events of the weekend, of the unenviable task facing the security services," she said.
"I repeat, sources' names may be withheld, redactions made.
"I do not intend to endanger the lives of anyone. I do not intend to allow questions which might do so."
Lady Justice Hallett's ruling hinged on the interpretation of Rule 17 of the Coroners Rules 1984, which gives the power to exclude the public from an inquest if it is in the interests of national security.
She concluded that this did not include "interested persons", like the bereaved families, who are entitled to be represented at the inquest.
The coroner raised the prospect of ministers either mounting a legal challenge to her ruling or using powers to transform part of the inquest into a public inquiry, which could examine secret documents in closed hearings.
Section 17A of the Coroners Act 1988, as amended in 1999, gives the Lord Chancellor power to adjourn an inquest if the death is being investigated by a public inquiry.
This provision was controversially used in the case of Azelle Rodney, 24, who was shot dead by police in London in 2005, after the inquest into his death stalled over the release of secret evidence.
But Lady Justice Hallett warned that adopting this route could lead to lengthy delays and extra heartache for the bereaved families and survivors of the attacks.
"A public inquiry, if ordered, as opposed to an inquest, will not necessarily be any more public and will not necessarily provide the bereaved families or survivors with the answers they want," she said.
"If the decision was taken to announce a judicial inquiry, it should not be thought that I can move seamlessly into the role of inquirer.
"There remains a very real possibility that these inquests would have to be adjourned and the whole process restarted - I emphasise the word 'restarted', not 'resumed' - at a much later date under a different person."
The coroner said any legal challenges to her ruling must be launched promptly and stressed: "No attempt at challenge is to derail these proceedings."
Graham Foulkes, from Oldham, whose 22-year-old son David was killed in the Edgware Road bombing, said he was "delighted" by Lady Justice Hallett's decision.
He said: "The Security Service have this 'get out of jail' card to trump all others when they say it's a matter of national security.
"They have tried this so many times it's like crying wolf.
"The basic argument I have is that they said in 2005 that Sidique Khan was only known to them on the periphery of their investigation and he was not a major player.
"But they say they can't open their files about him because they are so sensitive they threaten national security.
"The ruling she's given makes it very hard for them to maintain that position."
Lawyer Clifford Tibber, of Anthony Gold Solicitors, who is representing Mr Foulkes and five other bereaved families at the inquests, added: "Parliament has twice rejected attempts to introduce secret inquests.
"The coroner has today rejected a further attempt and has preserved the principle of open justice.
"Our clients rely on the full co-operation of the Security Service to help them understand what decisions were taken, whether anything more could have been done to prevent the bombings and what lessons can be learned for the future.
"They have every confidence in the coroner's ability to perform that task without having to resort to receiving evidence in secret."
The Home Office said it would consider the coroner's ruling "carefully".
The co-ordinated attacks on three tube trains and a bus launched on July 7 2005 by suicide bombers Khan, 30, Tanweer, 22, Hasib Hussain, 18, and Jermaine Lindsay, 19, were the worst single terrorist atrocity on British soil.
The inquest at the Royal Courts of Justice in central London is now in its fourth week and is expected to last five months.