Matthew Fisher, a founding member of 1960s rock group Procol Harum, has won a High Court battle over who wrote their hit song A Whiter Shade of Pale.
He played organ on the 1967 hit and argued he wrote the distinctive organ melody. Mr Justice Blackburne ruled he was entitled to 40% of the copyright.
Fisher, from London, had wanted half but the court decided lead singer Gary Brooker's input was more substantial.
Fisher's claim for back royalties - of up to £1m - was also rejected.
For almost 40 years, the song has been credited to lead singer Gary Brooker and lyricist Keith Reid.
"I find that the organ solo is a distinctive and significant contribution to the overall composition and, quite obviously, the product of skill and labour on the part of the person who created it," the judge said.
Now a computer programmer, Fisher said the organ solo was inspired by composer Bach but he also had "his own ideas in his head."
The 60-year-old said he made chord changes to the original Brooker sequence and added to the work with a counterpoint to the song melody.
Mr Justice Blackburne, who studied both music and law at Cambridge - followed a transcribed music score during the several occasions the song was played in court.
Brooker defended his claim to be the sole writer of the tune, which still provides him with royalties - boosted by its recent popularity in the mobile ringtone market.
The singer, who still fronts Procol Harum, faces paying a large part of the legal costs estimated at around £500,000.
In a statement, Brooker said his former bandmate had no right to be credited as a writer of the song: "If Matthew Fisher's name ends up on my song, then mine can come off!"
He added: "It's hard to believe that I've worked with somebody on and off since 1967 whilst they hid such unspoken resentment.
"I'm relieved the trial is over, but my faith in British justice is shattered."
Outside the court, Fisher insisted his case was not about the money, and he said he doubted whether he would ever play the song in public again.
He added: "I think I can assume that from now on I'm not going to be on Gary and Keith's Christmas card lists but I think that's a small price to pay for finally securing my rightful place in rock and roll history.
"I'd just like to say that it's a great pity that this matter could not have been resolved amicably."
The judge granted Brooker permission to appeal.