If you made a list of the factors that landed Donald Trump in the White House, Trump campaign digital director Brad Parscale would put Facebook near the top. “Facebook now lets you get to places—and places possibly that you would never go with TV ads,” Parscale told CBS earlier this month. “Now, I can find, you know, 15 people in the Florida Panhandle that I would never buy a TV commercial for. And, we took opportunities that I think the other side didn't.” The relationship with Silicon Valley wasn’t one sided: as major tech companies face mounting criticism for allowing political disinformation to proliferate on their platforms, a new study suggests that employees at Facebook, Google, and Twitter also took on crucial roles within the Trump campaign, acting more like political strategists than on-site salespeople.

The collaboration allowed Team Trump to shore up its digital operations in a way that would have been difficult to accomplish on its own, according to Politico, which got an early look at the study. Embedded tech employees took on responsibilities such as targeting hard-to-reach voters and coming up with responses to probable lines of attack during debates. “Facebook, Twitter, and Google [went] beyond promoting their services and facilitating digital advertising buys,” the peer-reviewed paper concludes. The companies “actively [shaped] campaign communications through their close collaboration with political staffers.”

The Clinton campaign turned down the assistance, which Facebook, Google, and Twitter all offered to 2016 candidates free of charge. (One tech company employee in the study said her campaign “viewed us as vendors rather than consultants.”) The Trump campaign, on the other hand, used the “embeds” extensively during the general election. Ultimately, the work each company did for Trump—Google recommending geographically targeted ads, Twitter analyzing the success of tweet-based fundraising efforts, and Facebook identifying which pictures performed best on Instagram, for instance—helped close the gap between him and Clinton, experts cited in the study conclude.

The collaboration likely proved lucrative for all three companies. Online political-ad spending during the 2016 election totaled $1.4 billion—the Trump campaign spent $70 million on Facebook alone, making client services a valuable extension of Facebook’s ad product. The collaboration also conferred additional benefits, as Politico points out: national exposure, a testing ground for new features and products, and the chance to build a relationship with a candidate who might end up holding the regulatory reins once in office.

In the wake of Trump’s victory, Silicon Valley is facing difficult questions about that symbiotic relationship, and a potential regulatory reckoning. It also underscores a nearly universal truth about how the tech and media industries treated the 2016 presidential race: employees at Facebook and Twitter, among other companies in the overwhelmingly liberal Bay Area, never really expected Trump to win.