A Sydney court has quashed the misconduct conviction of former NSW Labor minister Ian Macdonald, who has been behind bars since 2017.

Key points: Ian Macdonald granted a mining exploration licence to a company run by former union boss John Maitland

Ian Macdonald granted a mining exploration licence to a company run by former union boss John Maitland He was jailed in 2017 for 10 years for misconduct

He was jailed in 2017 for 10 years for misconduct NSW Premier Gladys Berejiklian said her Government would consider whether fresh legal action can be taken

Just hours later, Mr Macdonald walked free from Sydney's Long Bay jail and called for "an immediate inquiry into several of the ICAC matters which have involved me and others".

"There was much in the way of exculpatory evidence which was hidden from the original inquiry which has set the scene, I believe, for a long period of victimisation that I've experienced in the media," he said.

Mr Macdonald said he "absolutely" maintained his innocence and thanked his family and friends who had "stuck by me through this long period".

"I will now be spending the rest of the day with my family," he said.

In court this morning, Mr Macdonald's wife, Anita Gylseth, burst into tears and put her face in her hands when she heard he would receive bail.

Mr Macdonald was jailed for 10 years after being found guilty of misconduct in a public office over the granting of a mining exploration licence at Doyles Creek in the Hunter Valley.

A jury found he engaged in misconduct in public office by issuing the mine licence without a competitive tender to a company run by ex-union boss John Maitland.

Mr Macdonald had a non-parole period of seven years, while Mr Maitland was jailed for six years with a non-parole period of four for being an accessory.

The licence was issued in December 2008 by "direct allocation" when Mr Macdonald was the NSW minister for primary industries and resources.

Mr Maitland later earned $6 million from the sale of shares in the venture.

The Crown alleged the decision lost the state tens of millions of dollars at a time of budget restraint.

Anita Gylseth had a smile on her face as she left the Court of Criminal Appeal. ( ABC News: Selby Stewart )

At their trial, both men argued the mine licence was issued legally and denied any wrongdoing.

Mr Macdonald's lawyers argued he granted the licence because of the merits of the proposal and not because he was "mates" with Mr Maitland.

The former Labor minister also argued his sentence was excessive and the jury had no absolute proof his intentions were corrupt when he signed off on the main licence.

In his appeal, Mr Maitland said he was not responsible for any wrongdoing by Mr Macdonald.

In quashing the men's convictions, the Court of Criminal Appeal panel was critical of the way the trial judge — Justice Christine Adamson — summed the case up for the jury.

The panel found she "misdirected" the jurors about the state of mind needed to be found guilty of wilful misconduct in public office.

"It follows, in our opinion, with the greatest respect to the trial judge, that the jury was not properly directed on the mental element of the offence," their judgement said.

Former NSW Resources Minister Ian Macdonald is likely to face a retrial. ( AAP: Paul Miller )

Mr Maitland walked free from Silverwater Correctional Complex and thanked his family and supporters.

"It's good to be free," he said.

"The most important thing is that I've got my family with me. They've been through a massive emotional and financial trauma."

NSW Attorney-General Mark Speakman said the court granted a retrial of the charges.

"The independent Director of Public Prosecutions will have carriage of the matter and I will expect the matter will be prosecuted in the usual full and fair manner," he said.

"Given that there will be retrial or retrials, any further commentary from me would be inappropriate at this stage."

The case will be mentioned in court again in March.

New legal action a possibility

NSW Premier Gladys Berejiklian said her Government would consider whether fresh legal action could be taken.

"I don't want to jeopardise any future proceedings, but I'll say it's always concerning," she said.

Former union boss John Maitland is lead to a prison van in 2017. ( AAP: Joel Carrett )

During Mr Macdonald's sentencing in 2017, Justice Adamson described him as "devious" and said he betrayed the people of NSW.

The two had a misplaced sense of entitlement, she added, and neither had good prospects of rehabilitation because they showed no remorse.

At the time, Ms Berejiklian and then-opposition leader Luke Foley welcomed the sentence, with Ms Berejiklian describing Mr Macdonald as representing the darkest years of the Labor Government.

"We don't ever want to see that return to New South Wales," she said at the time.

"Any elected representative who does that wrongly by the people of the state deserves the book thrown at them."

Mr Macdonald, in his 1988 maiden speech in the NSW Parliament, spoke in support of an anti-corruption body, which would later become the Independent Commission Against Corruption (ICAC).

Mr Macdonald told fellow MPs the ICAC bill should not be allowed through the chamber without appropriate amendment and argued it could be used for political witch hunts.

The commission's findings would, in 2013, be used against him.

During the appeal, Mr Macdonald argued there was a miscarriage of justice because prosecutors used evidence compulsorily obtained from him at the ICAC.