A court has found Nicolas Sarkozy guilty of corruption and influence peddling and sentenced the former French president to three years in prison with two of them suspended.

He is the first former French president to receive a custodial sentence.

France’s president from 2007 to 2012 was accused of forging a “corruption pact” with his lawyer and a senior magistrate. Judges said there was “serious evidence” of collaboration between the three men to break the law.

In the ruling, the judge in Paris said Sarkozy could serve a year at home with an electronic tag, rather than go to prison.

The conservative politician “knew what [he] was doing was wrong”, the judge said, adding that his actions and those of his lawyer had given the public “a very bad image of justice”.

The crimes were specified as influence-peddling and violation of professional secrecy.

Sarkozy is expected to appeal against the conviction.

Sarkozy faces other accusations. In just over two weeks’ time he will once again be on trial accused of violating campaign financing rules during his failed 2012 re-election bid, by working with a friendly public relations firm to hide the true cost of his campaign.

In a separate case, French prosecutors are looking into alleged illegal campaign funding from Libya. Libya’s former deceased leader Muammar Gaddafi allegedly provided Sarkozy’s 2007 campaign with millions of euros shipped to Paris in suitcases.