His identity remained a mystery for eight years despite his star billing on one of the BBC's biggest shows. But today the Stig, the anonymous Top Gear driver disguised beneath a white crash helmet and blacked-out visor, was finally unmasked by a high court judge.

Mr Justice Morgan threw out a request from BBC's lawyers to grant an injunction preventing publication of an autobiography by Ben Collins, the racing driver who has played the character since 2003, following nearly two days of legal arguments heard behind closed doors.

Shortly before the ruling Collins, 35, strode down the steps of the Royal Courts of Justice in London but refused to confirm to waiting reporters that he is the man who trains celebrity guests to race around the Top Gear track.

The court proceedings, and the media interest that surrounded it, has bordered on farcical at times, not least because the Stig's identity had already been revealed. Collins, from Bristol, was named as the Stig by the Sunday Times in August, and photos of the driver have subsequently appeared in the press.

The BBC has repeatedly refused to confirm that Collins plays the character, however, as it seeks to protect the commercial value of one of its hit shows.

Simon Dowson-Collins, director of legal services at HarperCollins, which would publish the book, also refused to discuss the Stig's alter ego, but criticised the BBC . "We were very surprised the BBC took such action to prevent freedom of expression. We maintained all along that the information is already in the public domain," he said.

The request for an injunction was prompted by the corporation's determination to keep the identity of one of its employees secret after HarperCollins bought the rights to his life story.

Mr Justice Morgan ordered on Monday that the hearing should be conducted in private to ensure the case did not bring news of his identity to a wider audience.

The furore surrounding his forced unveiling is testament to the popularity of Top Gear, which regularly attracts an audience of 5 million armchair drivers in a Sunday BBC2 evening slot. Presenters Jeremy Clarkson, James May and Richard Hammond command high salaries, and the producers and co-creators have also profited from the show.

It has also become a huge money-spinner for BBC Worldwide, the corporation's commercial arm, which made pre-tax profits of £145m last year. It is regarded as one of a handful of "superbrands" with global appeal, along with other hit shows including Strictly Come Dancing.

Late last week Top Gear producer Andy Wilman angrily dismissed HarperCollins as "a bunch of chancers" and insisted that the Stig was effectively the property of the men who invented him.

However, the BBC's legal battle has not been motivated purely by a desire to protect the creative integrity of the character's creators. It also wants to prevent HarperCollins from cashing in on the Stig in a bid to protect the money-making potential of the show.

The fact that HarperCollins is owned by News Corporation, the media giant controlled by Rupert Murdoch, has given the legal battle a compelling subplot. The BBC director general, Mark Thompson, last week used the annual MacTaggart lecture to question whether News Corp should be allowed to take full control of BSkyB, the pay-TV company in which it is the largest shareholder.

Thompson warned that News Corp will become the dominant force in the British media industry if the deal is waved through by the government, which has the power to block it. He warned that Sky already "dwarfs" its commercial rivals.

Some senior executives at the BBC privately claim News Corp is using the Stig case to undermine the BBC as the two organisations fight a war by proxy. The BBC is waiting to see the court's full judgment before deciding whether to take Collins to court for breach of contract but has signalled it is likely to do so. The book is due to be published on September 16.

Nicola Cain, a member of the legal team working for the BBC, said: "This is about contractual obligations and confidential information." She added that she couldn't second guess what action the corporation would take, but said: "It isn't over yet."

Hidden talents

Belle de Jour

The anonymous author of the Diary of a London Call Girl hid her identity for six years, keeping millions of readers and literary experts guessing. After learning that she was soon to be exposed in a tabloid, Dr Brooke Magnanti, a 34-year-old scientist from Bristol, revealed last year that she was Belle de Jour and had worked as a prostitute to fund her PhD studies.

"Anonymous"

The best-selling roman à clef Primary Colors made waves in 1996 with its thinly veiled portrait of Bill and Hilary Clinton on the campaign trail, leading to a frenzy of speculation among political figures and commentators about the identity of its author. Following literary analysis of the book, political journalist and Newsweek columnist Joe Klein was named as author.

Nightjack

A policeman who wrote an award-winning blog under the name Nightjack lost his battle to retain anonymity after the high court overturned a temporary injunction against the Times, which had discovered his identity, in June last year. Richard Horton, a Lancashire detective constable, was told to take his blog down and received a written warning.

Banksy

Bristolian graffiti artist Banksy remains an elusive figure who keeps his identity fiercely guarded. It has even been suggested that Banksy is actually a collective of artists and doesn't exist at all. However, in 2008 a newspaper claimed the artist was Robin Gunningham, a former public schoolboy with a middle class upbringing.

Alexandra Topping