The former French president Nicolas Sarkozy is to face trial for alleged fraudulent financing of his failed 2012 bid for re-election, a legal source has said.

The case centres on an alleged system of false accounting used by Sarkozy’s office to conceal an enormous campaign overspend, mainly on the lavish rallies and US-style stadium gigs that cemented Sarkozy’s reputation as a political showman.

The limit on presidential campaign spending in France is €22.5m (£19.5m), and investigators suspect Sarkozy’s campaign spent €23m on top of that. Sarkozy has always denied any wrongdoing in the case, or even any knowledge of Bygmalion, an events company that allegedly concealed the overspend.

The case has become known as the “Bygmalion affair”. The company allegedly wrote fake invoices and falsely charged €18.5m to Sarkozy’s rightwing party – then called the UMP, since renamed Les Républicains – instead of billing the president’s campaign.

Sarkozy’s rallies during his 2012 election battle against the Socialist François Hollande were theatrical mega-productions, slickly coordinated by dedicated film directors, with specially laid carpet for his luxury dressing rooms and tens of thousands of euros spent on French flags to be waved by a sea of adoring fans.

But questions were asked over how the costly rallies were paid for.

Bygmalion executives have acknowledged the existence of fraud and false accounting and the trial will focus on whether Sarkozy was aware of it or made decisions about it.

A legal source told AFP that Serge Tournaire, one of two judges in charge of the case, had decided on 3 February that the case should go to trial after Sarkozy failed in a legal effort to prevent it in December. Sarkozy’s lawyer has announced plans to appeal.

One other former president – Jacques Chirac – has been tried in France’s fifth republic, which was founded in 1958. Chirac was given a two-year suspended jail term in 2011 after being found guilty of embezzling public funds to illegally finance the rightwing party he led. He was the first former French head of state to face prosecution since the second world war.

Questioned by police in September 2015, Sarkozy said he did not recall ever being warned about the accounting and described the controversy as a “farce”, putting the responsibility squarely on Bygmalion and the UMP.

Sarkozy’s ambitions to one day return to lead France were dealt a blow when he was eliminated in November in the first round of a primary contest to choose the right’s presidential candidate. Sarkozy trailed the eventual winner, François Fillon, and the former prime minister Alain Juppé.

Details of Sarkozy’s costly 2012 campaign and the role Bygmalion played have been reported by the investigative journalist Violette Lazard in a book, Big Magouilles. At one rally of 10,000 supporters in Nice, she claimed that luxury backstage canapés and champagne were provided for VIP supporters of the teetotal Sarkozy.

Scrambled eggs and spaghetti were infused with so much luxury truffle that one party worker worried the intense smell would waft out over the audience. “I was very embarrassed, wondering if the smell would reach the hall and what image that would create,” the unnamed party worker told Lazard. The backstage drinks and nibbles cost €50 a head.

Luxurious backstage dressing rooms were hastily put up for Sarkozy at conference centres and halls. At one rally in Villepinte, north of Paris, builders put up “not just a dressing room but an apartment”, according to a party official who was investigated in the case. He described “four rooms with an office, a reception room, toilets, a bathroom and a sort of antechamber where visitors could wait”. Before Sarkozy’s speech, 70,000 people stood chanting his name, but he did not hear it because the dressing room was entirely soundproofed at high cost, it is claimed.

At other rallies, where the president would typically spend only moments backstage, furniture by the luxury brand Hermès was hired and arranged for him, temporary bathrooms and showers were fitted and once, in Lyon, €1,000 was spent on royal blue carpet for a dressing room used only briefly.

Sarkozy’s team have repeatedly said they never demanded or asked for luxurious fittings. Sarkozy has always stressed he did not know anything about the spending or accounts, leaving that to his team.

At a time when the right was pushing the notion of national identity, in one week in April 2012 Sarkozy’s campaign team spent a total of €42,964 on 65,000 French flags for spectators to wave. At an earlier meeting in Villepinte, €44,000 was spent on flags. Similarly, at one rally €10,000 was spent on blue fabric to dress the metal railings keeping the crowd back from Sarkozy, because it was felt that stark metal railings made him look too aloof from the crowd.

One of the biggest spends was on giant video screens and the vast camera teams and established directors tasked with recording images to be fed to TV channels.

Bygmalion is not the first funding investigation into Sarkozy’s campaigning. A judicial investigation is looking at allegations that his successful 2007 election campaign received illicit funding from the Libyan leader Muammar Gaddafi. Sarkozy has dimissed the allegations outright.

His 2012 presidential campaign finances were rejected by an election watchdog and France’s highest constitutional body after he was officially found to have exceeded spending limits on a much smaller scale than the Bygmalion investigation is now looking into. After that ruling, Sarkozy’s indebted party was deprived of state subsidies as a punishment. In protest, Sarkozy launched a fundraising campaign known as the “Sarkothon” and raised €11m for the party.