The momentum gained from that success has now come to an abrupt end.

Mr. Green, who as first secretary of state operated as Mrs. May’s deputy, was under investigation over two separate allegations.

The first was that he made unwanted advances to a female journalist, Kate Maltby, in 2015, by “fleetingly” touching her knee in a pub, and later sending her a “suggestive” text message.

The second was related to claims that pornography was found on a computer in Mr. Green’s office in the House of Commons in 2008 — allegations that first surfaced when the police investigated whether official information was being leaked to Mr. Green, who was then an opposition politician.

In a statement on Wednesday, Mrs. May’s office said an inquiry by the Cabinet Office found that there were “competing and contradictory accounts of what were private meetings” between Mr. Green and Ms. Maltby, but that “the investigation found Ms. Maltby’s account to be plausible.”

It added that statements made by Mr. Green that he was unaware that indecent material had been found on parliamentary computers in his office, were “inaccurate and misleading, as the Metropolitan Police Service had previously informed him of the existence of this material.”

That appeared to be the decisive judgment as the Cabinet Office concluded that Mr. Green’s statements fell short of the “honesty requirement” in the ministerial code.

In his resignation letter, Mr. Green said that he regretted that he had been asked to quit and insisted that he had not downloaded or viewed pornography on his computer, but that he accepted that his public statements had been “misleading.”