Over the past week, opposition to the latest Republican effort to repeal and replace Obamacare has been driven by a late-night talk show host who had expressed little interest in health care policy prior to this year.

Jimmy Kimmel’s nightly monologues decrying Sen. Lindsey Graham (R-S.C.) and Bill Cassidy’s (R-LA) bill became must-see TV, as the ABC host systematically attacked both the specifics of the legislation and Cassidy himself.

Behind the scenes, the ABC star was getting an assist. Kimmel and his team were in touch with health care officials, charities and advocacy groups, multiple sources told The Daily Beast. He also was in touch with the office of Senate Minority Leader Chuck Schumer (D-N.Y) who, according to a source familiar with their conversations, “provided technical guidance and info about the bill, as well as stats from various think tanks and experts on the effects of [Graham-Cassidy].”

The three episodes in which Kimmel tore apart both Cassidy—who had previously insisted that any health care bill pass a so-called “Jimmy Kimmel test”—and the bill’s specifics helped galvanize public and political opposition to the legislation. On Friday, that legislation appeared to have effectively died, at least for now, after Sen. John McCain (R-AZ) announced that he would not back the measure without fuller hearings and amendments. Kimmel quickly took to Twitter to personally thank McCain for potentially tanking the legislation.

Kimmel was not a naif on the topic of health care. He had begun diving into the subject after his child was born with a congenital heart disease. He delivered an emotional monologue in May, as the Senate considered a different Obamacare repeal measure, about the care required for his son, who had received emergency surgery shortly after delivery.

But the TV host leaned on outside experts to ensure that as his show ventured away from pop culture and more to politics, he was standing on firm turf.

“Jimmy wanted to learn more about what was going on politically and policy-wise,” said a source with direct knowledge of the conversations, “[and] he wanted to fight this thing.”

Few, including Kimmel, expected that he would be playing this role. As recently as two weeks ago, the prospect of Obamacare repeal and replace appeared dead, with Senate Republicans having failed by one vote to push their previous attempt at overhauling Obama’s signature law. But with a September 30th deadline approaching for passing healthcare legislation by a simple majority vote, the party decided to take another stab.

Graham and Cassidy’s bill had the fortune of being the last one available. It would have dramatically cut back on Medicaid spending and turned over many insurance regulations to the states, thereby threatening the central promise that Cassidy had made to Kimmel after that May monologue: that any bill would ensure that a child born with a pre-existing condition would not have his or her family bankrupted by medical bills.

Sources close to Kimmel said he was prepared to speak out regardless, given Cassidy’s past invocation of “the Jimmy Kimmel test.” Schumer gave him encouragement to do so. The two had been in touch “periodically” over the last several months as prior legislative efforts were considered and their conversations continued when Graham-Cassidy began gaining steam. “It’s part of that continued conversation,” a source said.

Kimmel and his staff also spoke with other activists and organizations opposing Graham-Cassidy in an effort to do his due diligence and “his research,” said one person familiar with the process. People spoke on the condition of anonymity in order to speak freely.

“We’ve heard from and spoken to a lot of people, including Senator Schumer and the many charities and healthcare organizations that oppose this monstrous bill," a source from Jimmy Kimmel Live! told The Daily Beast.

The monologues were biting, and garnered plenty of media attention.

“This guy, Bill Cassidy, just lied right to my face,” Kimmel said in his first show, airing a clip of his May interview with the senator. “Stop using my name,” he said to Cassidy.

The ABC host revisited the topic the next night, going after Fox & Friends host Brian Kilmeade for questioning why he was weighing in on health care at all.

“I don’t get anything out of this, Brian, you phony little creep,” Kimmel shot back. “Oh, I’ll pound you when I see you. That is my blurb—that would be my blurb for your next book: ‘Brian Kilmeade is a phony little creep.’”

The following night, Kimmel went at it again, this time singling out President Donald Trump. “I guarantee he doesn’t know anything about this Graham-Cassidy bill,” he said of the president. “He doesn’t know the difference between Medicare and Medicaid. He barely knows the difference between Melania and Ivanka!”

It was the type of criticism that normally would elicit a direct reply from the president. But Trump and his Twitter account remained silent. Multiple senior Trump aides expressed surprise on Friday that the president hadn’t already hate-tweeted the late-night host. Asked why, one White House official told The Daily Beast, “I honestly don’t know. I thought we’d see something after the Kilmeade comments for sure.”

Other Republicans were more willing to push back. Cassidy insisted that Kimmel was out of his depth, and other lawmakers mocked the idea that a comedian would engage on health care policy. But outside analysts all came down on the side of Kimmel.

The toll Kimmel’s monologues took on Graham-Cassidy is ultimately unknowable, as the measure still seems likely to garner the support of all but a handful of Senate Republicans. But Democrats on Capitol Hill have viewed the ABC host as highly effective in large part because of his encouragement to viewers to call Senate offices to urge lawmakers to vote against it.

“It elevated the conversation and made sure that pre-existing conditions were being talked about again,” said Lori Lodes, adviser to the pro-Obamacare group, Protect Our Care. “It put a spotlight on how misleading all of cassidy’s information was in trying to get people on board. It did a good job in calling him on his lies.”

By Thursday, Kimmel was featuring prominently in Democratic political messaging, with the party’s senate campaign arm launching digital ads in a dozen states targeting vulnerable Republican senators by invoking the late-night host’s viral pleas for health care measures that protect those with preexisting conditions.

McCain’s opposition to the bill likely means it will not become law. Sen. Rand Paul (R-KY) has said he will vote against it and Sen. Susan Collins (R-ME) said she is leaning no.

Asked whether we should expect the president to lash out at Kimmel over his advocacy at this point, the White House official added, “He’ll probably be a little preoccupied with John McCain.”

—With additional reporting by Andrew Desiderio