The High Court has ruled that the Serious Fraud Office (SFO) acted unlawfully by dropping a corruption inquiry into a £43bn Saudi arms deal.
In a hard-hitting ruling, two High Court judges described the SFO's decision as an "outrage".
Defence firm BAE was accused of making illegal payments to Saudi officials to secure contracts, but the firm maintains that it acted lawfully.
The SFO said national security would have been undermined by the inquiry.
The legal challenge had been made by Corner House and the Campaign Against Arms Trade (CAAT).
'Failure of government'
In handing down the decision on Thursday, one of the judges, Lord Justice Moses, told the High Court that the SFO and the government had given into "blatant threats" that Saudi co-operation in the fight against terror would end unless the probe into corruption was halted.
He added that the SFO had failed to assure them that everything had been done to meet the rule of law.
|| This is a great day for British
Susan Hawley, Corner House
"No one, whether within this country or outside, is entitled to interfere with the course of our justice," he said.
"It is the failure of government and the defendant to bear that essential principle in mind that justifies the intervention of this court."
CAAT had argued that the SFO's decision to drop the probe was illegal under the Organisation for Economic Co-operation and Development's (OECD's) Anti-Bribery Convention.
"We are delighted," said CAAT's Symon Hill after the decision.
"It has been clear from the start that the dropping of the investigation was about neither national security nor jobs. It was due to the influence of BAE and Saudi princes over the UK government."
Susan Hawley of Corner House said: "This is a great day for British justice. The judges have stood up for the right of independent prosecutors not to be subjected to political pressure."
Following the judgement, BAE said: "The case was between two campaign groups and the director of the SFO. It concerned the legality of a decision made by the director of the SFO.
"BAE Systems played no part in that decision."
For its part, the Serious Fraud Office said it had no further comment, but was "carefully" considering the implications of the judgement.
The SFO's inquiry was into the al-Yamamah deal with Saudi Arabia, which was first signed in 1985 but ran into the 1990s.
Under the agreement, BAE sold Saudi Arabia Tornado and Hawk jets and other assorted weapons. The deal also included long-running maintenance and training contracts.
In December 2006, the then Attorney General, Lord Goldsmith, announced that the SFO was suspending its inquiry.
Lord Goldsmith said its continuation would have caused "serious damage" to UK-Saudi relations and, in turn, threatened national security.
Saudi Arabia is also reported to have threatened to cancel last year's deal to buy 72 Eurofighter Typhoon jets from BAE Systems.
Worth an initial £4.4bn, contracts for maintenance and training are expected to take the final bill to £20bn.
BAE argued that the SFO probe could "jeopardise" both this deal and "seriously affect" relations with the Saudi kingdom.
Details of the alleged bribes to Saudi officials were revealed in June of last year in an investigation by the BBC's Panorama programme.
It said that up to £120m a year was sent by BAE Systems from the UK into two Saudi embassy accounts in Washington.
Panorama established that these accounts were actually a conduit to Saudi Prince Bandar for his role in securing the al-Yamamah deal, something he has strongly denied.
The OECD said last month that it was launching its own investigation into the decision to drop the SFO inquiry.
The judges in London did not rule that the case would be reopened, but have said they would listen to further arguments.