Former French president Nicolas Sarkozy has been released from jail, three weeks into a five-year prison term for taking part in a criminal conspiracy.

He will be subject to strict judicial supervision and barred from leaving France ahead of an appeal trial due to be held next year.

On 21 October, the former centre-right president, 70, was sentenced to five years for conspiring to fund his 2007 election campaign with money from late Libyan dictator Muammar Gaddafi.

His legal team immediately filed a request seeking his release.

Writing on social media after the release, Sarkozy said his energy is focused solely on the single goal of proving my innocence.

The truth will prevail... The end of the story is yet to be written.

Sarkozy's car was seen leaving La Santé prison in Paris just before 15:00 (14:00 GMT), less than an hour-and-a-half after a court agreed to his early release. Soon after, he was seen arriving at his home in western Paris.

Christophe Ingrain, one of Sarkozy's lawyers, hailed his client's release as a step forward and said they would now be preparing for the appeal trial expected in March.

One condition of Sarkozy's release is he does not contact any other witnesses in the so-called Libyan dossier or any ministry employees.

During his incarceration, he was visited by Justice Minister Gérald Darmanin. The visit prompted 30 French lawyers to file a complaint against Darmanin, alleging a conflict of interest.

Speaking to a court in Paris via video link on Monday morning, Sarkozy described his time in solitary confinement as gruelling and a nightmare.

He asserted that he had never had the mad idea of asking Gaddafi for money and would never admit to something I haven't done.

Sarkozy's wife, the singer and model Carla Bruni-Sarkozy, and two of the former president's sons were present in the courtroom to support him.

Sarkozy is the first French ex-leader placed behind bars since World War Two. Since entering prison, he has been held in solitary confinement, allowed only an hour of exercise per day.

Despite the challenges, Sarkozy paid tribute to the prison staff for their exceptional humanity during his time incarcerated.

He had previously served as president from 2007 to 2012.