At the final debate of last year's presidential campaign, Hillary Clinton ridiculed Donald Trump as a "puppet" of the Russians and denounced his treatment of women. She was widely seen as the winner that night in Las Vegas and the favorite to win the presidency weeks later.

On Facebook, however, a different story was unfolding for millions of Americans, whose feeds were being saturated with eye-catching ads bolstering Trump.

Out of view of the broader public, the site was serving as a platform for an intense barrage of advertisements tailored to reach Trump's supporters with maximum impact throughout the debate day and night. By the end of the day, the Trump campaign had run 175,000 variations of ads on Facebook, pushing distinct versions to different users to test which ones worked best. The high-velocity churn drew $9 million in donations, the campaign's biggest single-day money haul of the year.

Facebook's recent revelations that it sold thousands of ads to a Russian troll operation seeking to foment discord during last year's elections have led its executives to pledge cooperation with U.S. investigators. But the company's role in the Russia probe is also prompting uncomfortable scrutiny of its increasingly lucrative political advertising business and how little is known about the ads voters are exposed to online.

The situation has the potential to affect a key profit center for Facebook. The same proprietary technology that has made Facebook the go-to advertising platform for political campaigns also enabled Russian operatives to target U.S. voters with inflammatory ads . Now lawmakers, noting that online companies are not subject to disclosure rules governing broadcast advertising, are calling for tighter regulations as Facebook is poised to play another major role in the 2018 and 2020 elections.

Trump strategists credit their victory in part to a decision to go all-in on Facebook in the closing stretch of the 2016 race, with a strategy that was orchestrated from a San Antonio office where Trump campaign and Republican Party staffers worked alongside Facebook sales employees, blitzing the country with ads.

By Election Day, Trump's campaign had spent roughly $70 million on Facebook alone — nearly all in the last four months of the election, according to people familiar with the spending.

"If you imagine the country as the haystack, Facebook is the needle finder," said Brad Parscale, who served as the Trump campaign's digital director.

With 210 million U.S. users logging in monthly, Facebook offers candidates and their allies the ability to zero in on potential voters who are likely to embrace their messages and make them go viral — identifying them by geography, gender, interests and their behavior across the Internet, including their "likes" for music, food and travel. The company owes its rich trove of data to its users, who turn over details about their personal lives every time they engage with the platform.

The large sums invested by the Trump campaign would have been enough to put an ad on the feed of every Facebook user in the country, digital strategists said, or to send multiple ads to key voters. The online bombardment, which former Clinton aides acknowledged surpassed their Facebook spending, was largely invisible to the media and the electorate. That's because of its highly personalized design, which allows advertisers to target voters in a granular fashion.

Advocates for more online transparency say the 2016 election showed how Facebook and other websites can be used to push provocative messages with no oversight.

The news that Russians used Facebook to try to influence voters showed that people with "no interest in adhering to facts or the truth are able to message to select pockets of the population to elicit an emotional response, and no one knows that it is happening," said Keegan Goudiss, who served as director of digital advertising for Sen. Bernie Sanders's presidential campaign, which relied heavily on Facebook.

After revealing the Russian ad buys, Facebook vowed to provide more transparency about political ads on its site, a move that could pull the curtain back on its position as a turbocharged platform for campaigns. After years of resisting disclosure, the company has pledged to create a mechanism that will reveal the content of political ads posted on its site, making them visible to any Facebook user. The system would go further than what is required of TV and cable stations, which have to disclose information about who purchases political ads but not the content of the ads themselves.

"We are in a new world," Facebook chief executive Mark Zuckerberg said in a post last month. "It is a new challenge for internet communities to deal with nation states attempting to subvert elections. But if that's what we must do, we are committed to rising to the occasion."

Still, the ongoing Russia probes could have a long-term impact on the company, which is now contending with new efforts to regulate online political advertising.

Democratic Sens. Amy Klobuchar (Minn.) and Mark R. Warner (Va.) plan to introduce a bill in the coming weeks that would require sites with more than 1 million users to maintain a public file containing a copy of political ads and information about who they are aimed at. The measure, which the lawmakers said was a direct response to the Russian effort, would require information about the number of views generated and the rates charged by platforms such as Facebook.

"These ads are literally being seen by millions and millions of people, but there's really not the transparency that you see with traditional ads," Klobuchar said.

"Aside from the Russia issue, it is a glaring problem because our technology has changed, the way people advertise has changed, but our laws are back in the 1980s," she added.

[Facebook, Google and Twitter face proposed bill targeting shadowy political ads]

Facebook, which as recently as 2011 sought an exemption from the Federal Election Commission from having to run political disclaimers on the small ads that run on its site, has taken a cautious posture toward the prospect of new regulations even as it has pledged to provide more voluntary disclosure. The company said in a statement that it is "open to reviewing any reasonable proposals."

Facebook's ascent in elections has been rapid, mirroring its sevenfold increase in value since the company went public in 2012. At the time, the company had just a handful of staffers in its Washington office focused on lobbying and on campaign advertising.

That year, the reelection campaign of President Barack Obama developed an innovative Facebook application, allowing 1 million supporters to give the campaign access to their extended Facebook "friend" networks.

The ability to tap into that kind of data free was shut down in 2015, when Facebook limited the amount of information that campaigns and other third-party groups can access from the site. As a result, campaigns still eager to tap into Facebook's fast-

growing database began buying more ads, political strategists said.

While businesses still spend more on Google advertising, many political advertisers began favoring Facebook in 2014, campaign strategists said. The site's ability to offer rich targeting and near real-time feedback, as well as its role as a platform for civic debate, makes Facebook better tailored to political messaging, said Zac Moffatt, who heads the Republican digital ad agency Targeted Victory.

During the height of the 2016 campaign, Facebook had 10 staffers — five on the Democratic side and five on the Republican side — who helped federal campaigns with their ad buys, according to people familiar with the company's operations.

Unlike the Trump campaign, Clinton's team declined to have the company's sales employees work side-by-side with its staff, though Facebook employees did visit Clinton's Brooklyn headquarters from time to time, according to people familiar with the setup. Clinton, who entered the general election with more resources than Trump, was less reliant on Facebook, but her former campaign officials declined to share how much they spent on the platform.

Facebook regularly deploys sales staff to work with big corporate and political clients. Typically, Facebook employees provide advice to big clients on how to target users across all the company's platforms, including Instagram and Messenger, helping advertisers decipher which approaches would be likely to get the most engagement.

For example, Facebook might advise campaigns on whether to target a large number of potential voters in a specific Zip code, according to people familiar with the process.

When content goes viral, it helps Facebook make money. Advertisers pay for people to view an ad. They pay more money if people click on that ad or if they click through the ad to a page outside of Facebook or install an advertiser's application, advertisers say.

Goudiss, the former Sanders digital advertising director who is a partner at the firm Revolution Messaging, said the impact of Facebook on political races could not be overstated.

"Facebook was one of the key reasons Bernie went from 2 percent name ID to winning primaries," he said.

The Trump campaign's large investment in Facebook was driven in part by necessity. When the wealthy real estate executive secured the GOP nomination in the late spring, he had virtually no fundraising operation.

Campaign officials and Republican Party strategists from Washington who embedded with the Trump digital shop in San Antonio turned to Facebook ads to rapidly build a donor list.

"I knew that it would be a lead dog in the pack," said Gary Coby, who was dispatched from the Republican National Committee to serve as the campaign's director of digital advertising and fundraising. "But we always built in the idea of a dynamic budget — you move the money to where it is best performing. Facebook was one of the things that was working, so we put more money and time into it."

More than half of the campaign's Facebook budget was spent on ads designed to pull in contributions, many of them featuring some of Trump's most provocative remarks. "Only Trump can stop Crooked Hillary," declared one ad in June. "Teach Hillary Who's Boss."

In a setup that officials said resembled a high-frequency Wall Street trading shop, the Trump operation pitted teams of staffers and outside ad buyers against each other to see which could get more Facebook users to convert into donors. Those who won got more money to play with.

Each day, the campaign would start with about 20,000 ad variations, testing different messages against a complex set of targeting factors such as age and device usage, as well as past actions such as recent donations. Throughout the day, they swapped in various images of Trump or short-burst videos with captions, hunting for the most viral combination.

"You want to make sure you have all different ad variations and different segments for your ads so that you can find something that works fast, and then Facebook will show it to more people," Gerrit Lansing, the RNC's former chief digital officer, explained at a post-election political marketing conference sponsored by MediaPost in January.

"You find these little bursts of things that work, and then pour gas on it and do that dozens of times every day," he added.

By the end of a typical day, the Trump operation averaged 40,000 to 60,000 ad variations — a supercharged version of the kind of comparative testing many campaigns use.

Like the Sanders campaign, the Trump team found that Facebook ads served multiple functions: as powerful fundraising appeals, as vehicles to win over new supporters, and eventually as a mechanism to prod voters to go to the polls, officials said.

The constant feedback the campaign received about how Facebook users engaged with different ads also provided valuable political insight into what moved Trump's supporters, campaign strategists said. After an intense round of testing showed that his backers responded strongly to messages about what Trump pledged to do in office, the campaign rolled out policy speeches featuring the candidate.

In the end, half of the Trump campaign's overall advertising budget was spent online — nearly double the share a typical campaign devotes to digital ads — and the majority of that went to Facebook.

"People are coming to grips with the fact that the world's biggest social network is playing an unprecedented role in politics and in government in the distribution of ideas," said Alex Howard, deputy director of the Sunlight Foundation, a nonpartisan watchdog group. "For many people, Facebook is the Internet. It is an extraordinarily powerful force with limited accountability."