The controversial appointment of Zac Goldsmith to the House of Lords by Boris Johnson has been compounded by a Tweet he sent in 2012 criticising the peerage system.

Mr Goldsmith has been accused of hypocrisy on social media over the Tweet and is now able to retain his role as environment minister as a result of his new title.

Downing Street has dismissed allegations of cronyism over the appointment of Mr Goldsmith, the ousted Tory MP, to the Lords so he can keep his job in the government.

His appointment came after Nicky Morgan controversially kept her Cabinet post as culture secretary, despite standing down as an MP at last week’s election, when she was made a life peer.

Asked about the criticism, Mr Johnson's official spokesman said: “Zac Goldsmith was doing an excellent and committed job in Cabinet, dealing with really important issues, and he will now be able to get on with that work and carry on delivering.”

The spokesman repeated his praise when asked if it was reasonable to swiftly reward an MP who lost to the Liberal Democrats by 7,766 votes.

Number 10 declined to directly comment on the environment minister’s apparent previous criticism of the peerage system in the 2012 Tweet.

Labour has accused Mr Johnson of using the peerage system to appoint “jobs for mates” after voters in Richmond Park emphatically rejected Mr Goldsmith in the General Election.

The spokesman was unable to say how Mr Johnson convinced the minister to stay on, saying: “I don’t have details of any conversations.”

Mr Johnson's partner, Carrie Symonds, worked on the life peer's failed bid to succeed Mr Johnson as London mayor.

Shadow culture minister Jon Trickett said Mr Goldsmith, whose failed London mayoral campaign against Labour’s Sadiq Khan in 2016 was mired in allegations of racism, accused the government of cronyism.

“It says everything you need to know about Boris Johnson’s respect for democracy that he has ignored the voters of Richmond Park and appointed Goldsmith to government,” he said.

“The public deserve better than a government appointed by ‘jobs for mates’.

“At a time when the Conservatives are investigating racism in their party, they’ve appointed the person who ran an overtly racist campaign against Sadiq Khan.

“Zac Goldsmith is not fit to hold any government position.”

Lib Dem Sarah Olney, who took the Remain-supporting constituency from Mr Goldsmith, who backed Brexit, echoed the allegations of cronyism.

“It is the first days of Parliament returning and already Boris Johnson is rewarding his cronies with peerages,” she said.