Consent was given for a total of 335 turbines at the Inch Cape, Neart na Gaoithe, and Seagreen Alpha and Bravo schemes in 2014, but RSPB Scotland campaigners insist they pose too great a risk to globally important seabirds.
They say thousands of gannets, puffins, kittiwakes and other species from protected sites such as Bass Rock and the Isle of May would be killed every year if they go ahead.
The developments were expected to provide 2.284 gigawatts of green energy, enough to power over 1.4 million homes every year.
It is estimated the schemes would save 135 million tonnes of climate-warming carbon dioxide over their lifespans.
Many environmentalists had welcomed the plans but RSPB Scotland said the impact on seabirds would be too great.
Scottish Natural Heritage, the government’s statutory nature advisors, and the Joint Nature Conservation Committee also raised concerns.
The Court of Session has now quashed the consent, so the four projects cannot proceed.
RSPB Scotland has welcomed Lord Stewart’s ruling.
“The judge found in favour of our arguments, which we welcome, but the big picture is that it’s not actually a victory or a loss for either side,” said Lloyd Austin, head of conservation policy for the charity.
“What we would like to see come out of it is improved environmental assessment and a more rigorous decision-making process that encourages the right types of renewables in the right places, because we do need them.
“However, we want them to be in harmony with nature.
“To prevent damaging proposals slipping through the net we need a rigorous process, and it was that process that was found to be flawed in these cases.”
Minister for business, innovation and energy Paul Wheelhouse said the Scottish Government remains “strongly committed” to the development of offshore wind energy for both its economic and environmental benefits, but insisted protecting Scotland’s marine environment is “of paramount importance”.
He added: “We are keen to work constructively with both the RSPB and renewable energy developers to ensure the sector has a bright future in Scotland.”