Nicolas Sarkozy has been questioned by a judge over allegations that he received envelopes stuffed with cash to fund his successful 2007 election campaign.

The donations are said to have come from the L'Oréal heiress Liliane Bettencourt, the richest woman in France. The former president was also questioned over allegations that he and his supporters took advantage of the 90-year-old billionaire's frail state of mind, and that he used his presidential power to hamper criminal investigations into the scandal.

Sarkozy, who lost his immunity from prosecution when he failed to secure a second term in office in May, has denied any wrongdoing.

Arriving at Bordeaux airport by private jet and was driven to the courthouse in a Renault Espace with blacked-out windows, he declined to comment as he entered the Palais de Justice, and his appearance before the judge d'instruction was closed to the press and public. He is accused of accepting €150,000 (£120,000) from Bettencourt in campaign donations, contrary to election rules that limit donations to €4,600. Police raided his home and offices in July as part of the inquiry, run by judge Jean-Michel Gentil.

The scandal, which broke in 2009 when Sarkozy was still president, started as a family row over whether Bettencourt, whose father founded the L'Oréal cosmetics company, was well enough to manage her estimated €17bn fortune. It turned political when Bettencourt's accountant claimed the heiress had given Sarkozy and his advisers cash donations.

Sarkozy's court appearance, which lasted 12 hours, came amid calls for him to return to politics following the implosion of his centre-right UMP party after a contested leadership battle. A poll showed 52% of party members thought Sarkozy, who has kept a low profile since his defeat, stood a good chance of beating François Hollande in 2017. Only 24% had the same opinion of François Fillon and 15% for Jean-François Copé, both involved in a venomous public spat over who should run the UMP.

A ballot of party members to choose a new leader and decide the future direction of the party was deemed too close to call on Sunday evening, when Copé pre-empted a recount by declaring he had won, in what political commentators described as the behaviour of a "South American colonel, circa 1960". A day later, Copé was officially declared the winner by just 98 votes out of nearly 175,000.

On Wednesday, however, Fillon claimed that votes from three overseas districts had been forgotten and gave him a narrow win of 26 votes. The conflict has left the party divided and derided and on the brink of collapse. Copé, 48, has portrayed himself as Sarkozy's natural successor, and veered to the right, picking up populist themes including "anti-white racism". Former prime minister Fillon, 58, who led the polls throughout the leadership campaign, ploughed a centrist furrow and was supported by a majority of UMP MPs.

Each claims the other cheated, and, amid all the sound and fury, it seems to be almost universally accepted that there were irregularities in the ballot.

Fillon is not demanding to be party president but is saying that Copé should not be either, insisting his rival step aside and allow party grandée Alain Juppé, the former foreign minister, to take temporary control of the UMP.

Fillon has threatened legal action if Copé refuses – which he has. Appeals by UMP officials for calm and warnings that the future of the party is at stake have gone unheeded.

Christian Jacob, head of the UMP group in the Assemblée Nationale and a Copé supporter, called on Fillon to "blow the whistle for the end of playtime". But Copé was in no mood to follow his own adviser's advice.

"This is the story of a bad loser who is giving moral lessons he has never himself followed," Copé said of Fillon, accusing his rival of orchestrating the party's "suicide".

Political commentator Hervé Gattegno of the right-leaning Le Point magazine said the shambles would be amusing if not so serious. "The UMP is less on the brink of implosion and more on the brink of ridicule," he told RMC radio.

"The great temptation is to turn this fiasco into a laughing matter but we have to resist because what has happened at the UMP for the last four days does a dishonour to politics and those who practise it."

• This article was amended on 23 November 2012. The original sub-heading referred to Sarkozy's re-election campaign and the text referred to Le Pont magazine. That should have been election campaign and Le Point magazine respectively. Both have been corrected.