For years, it is a wonder that Volkswagen managed to produce any cars at all. Europe's biggest automobile company, and the leading symbol of corporate Germany, was embroiled in a widespread scandal involving sex, bribery and pleasure trips, the scale of which the continent has not seen before.

In a courtroom investigation in Braunschweig in Lower Saxony, in the north west, details of the €2.5m affair have been unfolding and the nation has been poring over the lurid details. They involve a string of expensive hookers, sex parties and expense-account shopping trips which took place over the best part of a decade, endorsed by a management keen to buy the support of union officials and the shopfloor at a critical time for the company. The scandal has claimed the scalp of the personnel director Peter Hartz - who was convicted at a trial last year - along with two senior managers and the chairman of the powerful works council.

Last Wednesday the excitement of the courtroom reached fever pitch following the arrival - appropriately in a black VW Tiguan, driven by his wife Ursula - of the patriarch of Germany's car industry and VW's current chairman, Ferdinand Piech. He was the company's chief executive between 1993 and 2002 when the alleged offences took place. Piech is also at the centre of Porsche's current nail-biting takeover of Volkswagen.

He is also a man said to be so involved in the detailed running of the company that during his time as chief executive he decided the colour of the car dashboards and had informants tell him what was going on across the company. Prosecutors hoped the appearance of Piech - not under investigation and called only as a witness - would mark a turning point in the trial. He is giving evidence in the corruption trial of Klaus Volkert, a former head of the VW works council charged with receiving about €2m (£1.3m) in illegal bonuses as well as paid holidays for Adriana Barros, his Brazilian mistress, and Klaus-Joachim Gebauer, a former VW personnel manager accused of endorsing the payments to Volkert.

But Piech, 70, a grandson of Ferdinand Porsche, the luxury car's founder who also made the Volkswagen, or People's Car, for Adolf Hitler, referred to the slips of protocol which led to the brothel and slush-fund affair as mere 'irregularities' about which he had 'not been aware'.

The 'irregularities' cover a host of alleged abuses that took place worldwide, from Barcelona to Seoul, Prague to Delhi. Managers endorsed a company slush fund to pay for high-class prostitutes and to sponsor the mistresses of trade union officials, as well as regular visits to brothels, cash gifts for wives and even free supplies of Viagra. There also existed an illegal network of front companies set up to channel money from VW suppliers abroad.

According to the defence team in the trial, the reward system - which came to light in 2005 when a VW insider revealed that it had been going on for a decade - was sanctioned from on high. On one VW trip to Lisbon in 2003, a Brazilian prostitute was 'ordered' by a senior manager who requested a 'young and lively dark-skinned girl'. He was so impressed by her performance that she was flown first-class to Paris and delivered to the George V Hotel, where the executive was attending a board meeting. On another occasion, wives of works council members were given gift vouchers for the luxury chain Hermès and taken on a shopping spree in Paris.

In court last week a secretary to Gebauer, the former VW personnel manager who is in the dock on charges of abetting breach of trust, was close to tears as she told of her distress at having to 'go beyond my call of duty' and, at the behest of her boss, look for a flat in Braunschweig where union leaders could go for their trysts with prostitutes. 'I found it really very unpleasant,' said the 41-year-old secretary named only as Silke W. She described finding a flat with an underground garage and a lift that went to the door of the sixth-floor flat to ensure the men's privacy. Once she had secured the flat, she was then given the task of arranging the decor.

The Social Democrat MP Hans-Jurgen Uhl, a member of the works council until 2006, who has already been fined for his involvement, told the court that on works council trips 'everything was centred on the number one topic' - sex.

At the heart of the matter is a system which has delivered decades of harmonious labour relations - Mitbestimmung, or co-determination - in which workers and unions are involved in the workings of management and its decision-making. Advocates of co-determination say this model of social consensus helps raise productivity and enables Germany to maintain a large manufacturing base - making it the envy of countries like Britain. Critics say it is open to abuse, as the VW imbroglio seems to bear out.

During his day in court Piech pointed out that the company, which he had found in a 'catastrophic state close to collapse' when he took over as its chairman, had been transformed into a success story. The implication was that the 'irregularities' were a small price to pay if they contributed to such a turnaround.

But the case has enraged millions of ordinary Germans, understandably smarting at the lurid reports of ostentation and sleaze after several years in which they have been forced to face wage freezes and welfare cuts. And they are well aware that the glory days - when VW made cars for the masses rather than rivalling luxury brands like Mercedes and BMW - are over.

While giving evidence, Piech, who is reportedly Germany's highest paid executive, rubbed salt into the wound with his rebuke to a lawyer over his mispronunciation of the name Lamborghini, the luxury sports car which is part of the VW group. 'Everyone who buys a Lamborghini can pronounce the name just as he likes,' Piech said. 'But those who can't afford one should say it properly.' The case continues this week when Piech's successor as CEO, former VW head Bernd Pischetsrieder, is due in the witness box.