LONDON — Prime Minister Boris Johnson, a product of the British establishment, has sought to give his government an anti-establishment edge by relying on the instincts of his unconventional chief adviser, Dominic Cummings.

But Cummings’s hiring of an aide with a digital trail of comments seeming to support eugenics has resulted in major embarrassment for Johnson’s government.

Andrew Sabisky, a political “forecaster,” resigned Monday night following backlash over his past comments that black Americans tend to be less intelligent than white Americans and that enforced contraception could stop a “permanent underclass.”

Sabisky was a recent hire by Cummings, who last month wrote a 3,000-word blog post calling for “weirdos and misfits with odd skills” to apply for roles within the British government.

Cummings said the government didn’t need more “drivel” from humanities graduates from Oxbridge — the shorthand for Oxford and Cambridge universities — but “genuine cognitive diversity.”

“We need some true wild cards, artists, people who never went to university and fought their way out of an appalling hell hole,” he wrote.

He said it was time to shake things up. “Brexit requires many large changes in policy,” he wrote, adding that the recent election meant that there was “little need to worry about short-term unpopularity while trying to make rapid progress with long-term problems.”

Cummings is often painted as something of a Machiavellian genius and has been widely lauded for his electoral skills. As head of the 2016 Brexit campaign, he is said to have penned the winning slogan “take back control.” He also is credited with the Conservative Party’s “get Brexit done” catchphrase during the December election that Johnson won with a thumping majority.

But now that the party has shifted from campaign mode back to governing, Cummings’s anti-establishment efforts are under renewed scrutiny.

Caroline Nokes, a Conservative lawmaker and chair-elect of the Commons Women and Equalities Committee, questioned the vetting process for advisers.

“We absolutely have to agree it was mission accomplished. They found a weirdo and misfit, didn’t they?” she told Sky News. “But it’s right that we should have a process where people are appointed to very important and influential roles in Downing Street that they should go through a proper vetting process.”

It is thought that Sabisky, 27, responded to Cummings’s call for unconventional recruits. He reportedly studied educational psychology and worked as a political events forecaster before joining the government.

Over the weekend, some of his comments were printed in the British press.

In 2014, Sabisky wrote on Cummings’s blog that one way to stop “unplanned pregnancies creating a permanent underclass” would be to “legally enforce universal uptake of long-term contraception at the onset of puberty.

“Vaccination laws give it a precedent, I would argue,” he said.

He wrote: “If the mean black American IQ is (best estimate based on a century’s worth of data) around 85, as compared to a mean white American IQ of 100, then if IQ is normally distributed (which it is), you will see a far greater percentage of blacks than whites in the range of IQs 75 or below, at which point we are close to the typical boundary for mild mental retardation.”

The comments were denounced across the political spectrum.

Business minister Kwasi Kwarteng told Sky News on Tuesday that Sabisky’s remarks were “offensive” and “racist” and “as soon as they came to light, he left the government pretty quickly.” He added that the process for recruiting staff needed to be “looked at.”

Ed Davey, acting leader of the Liberal Democrats, said Johnson needed to “make crystal clear why he signed off on this appointment and curb Dominic Cummings’s power to appoint and sack at will.”

Jess Phillips, a prominent Labour lawmaker, tweeted: “The defence of Sabisky being only 27 is an odd one. I had two kids when I was 27 (which admittedly his “weirdo” ideas may have prevented). 27 year olds don’t get lesser sentences in court, 27 year olds don’t have to pay less tax.”

Before deleting his Twitter account, Sabisky wrote that the “media hysteria about my old stuff online” was “mad.” He added that “I hope no. 10 hires more ppl w/ good geopolitical forecasting track records & that media learn to stop selective quoting.”

“I know this will disappoint a lot of ppl but I signed up to do real work, not be in the middle of a giant character assassination: if I can’t do the work properly there’s no point, & I have a lot of other things to do w/ my life,” he said in another tweet.

Supporters of Cummings’s approach say that bureaucracies everywhere — from Washington to Whitehall — can become entrenched and need some flushing.

Cummings was asked on Tuesday if he regretted the appointment.

He didn’t answer, but in a seeming defense, he directed reporters to scholarly work on political prediction by Philip Tetlock of the University of Pennsylvania and Dan Gardner of the University of Ottawa.

“Read Philip Tetlock’s [‘Superforecasting’], instead of political pundits who don’t know what they’re talking about,” Cummings said.