UK’s first secretary of state Damian Green, a key ally of Prime Minister Theresa May, has stepped down after acknowledging that he had broken the ministerial code by misleading investigators about using pornography on his office computers.

In a resignation letter made public on Wednesday night, Green denied the accusations but admitted that he had not been forthcoming in statements about the matter.

“I accept that I should have been clear in my press statements that police lawyers talked to my lawyers in 2008 about the pornography on the computers, and that the police raised it with me in a subsequent phone call in 2013,” Green said in his resignation letter, which was made public Wednesday night.

In 2008, police arrested the disgraced politician on suspicion of “aiding and abetting misconduct in public office” and “conspiring to commit misconduct in a public office.”

In November, however, he said on two occasions that police had never claimed that there where indecent images on his computers. He said then that the accusations were “false, disreputable political smears” and amounted to “an unscrupulous character assassination.”

Earlier, a report conducted by May’s Cabinet secretary concluded that Green knew about the indecent images found by police.

May personally wrote a letter to Green, asking the close political ally and supporter to give up his position.

“I have also carefully considered the report’s conclusions in relation to two statements you made on 4 and 11 November which you now accept were inaccurate and misleading,” the prime minister wrote in a letter requesting Green to step aside. She said he had fallen short of the standards expected of him.

“It is therefore with deep regret, and enduring gratitude for the contribution you have made over many years, that I asked you to resign from the Government and have accepted your resignation,” May wrote.

This will deal a heavy blow to May’s efforts in reuniting a cabinet that has been divided over the country’s pending exit from the European Union (EU).

Both May and Green had campaigned against Brexit in last year’s EU referendum, which saw 52 percent of Britons vote in favor of ending the UK’s decades-long membership in the bloc.

Jeremy Hunt, the health secretary, told The Guardian in an interview that May didn’t want Green to go but there was no other options because he had “lied.”