In the end, they remained faithful electors.

Amid protests across the country, members of the Electoral College on Monday formally confirmed Donald Trump as the next president of the United States.

By early Monday evening, the president-elect clinched the 270 electoral votes required to officially win the White House. Hillary Clinton trailed far behind, with 166 votes, including 29 from New York.

“With this historic step we can look forward to the bright future ahead. I will work hard to unite our country and be the President of all Americans. Together, we will make America great again,” Trump said in a statement.

One “faithless elector” in Maine voted for Bernie Sanders instead of Clinton, but his vote was ruled improper and he had to vote for Clinton instead.

“I cast my Electoral College vote for Bernie Sanders today to let those new voters who were inspired by him know that some of us did hear them, did listen to them, do respect them and understand their disappointment,” Maine elector David Bright wrote in a statement on Facebook.

Another elector in Minnesota, Muhammad Abdurrahman, also refused to vote for Clinton, and was replaced by an alternate. A third elector in Colorado, Michael Baca, also declined to vote for Clinton, and was replaced.

So far, no GOP electors have voted against Trump, despite a nationwide movement urging College members to go rogue and cast ballots for another candidate. Chris Suprun, a Texas elector, said he would support John Kasich, the Ohio governor and former GOP presidential candidate, but the vote wasn’t expected until later Monday.

In Pennsylvania, protesters made a last-ditch effort to influence electors, screaming, “Vote your conscience” from the House gallery. At least 12 of the Keystone State’s 20 electors were given police protection as they voted, the Post Gazette reported.

In Wisconsin, protesters braved frigid temperatures to demonstrate outside the state Capitol, and some chanted “shame” after all 10 electors cast ballots for Trump.

New York’s vote in Albany was a solemn affair.

Former President Bill Clinton, who cast a ballot of his wife, said afterward, “I was never prouder to cast a vote.”

“I watched her work for two years. I watched her battle that bogus email deal … She prevailed against it all,” he said. “Then in the end we had the Russians and the FBI deal. She couldn’t prevail against that.”

In the weeks before the historic vote, Democratic advocates waged an aggressive campaign by email, snail mail and social media to get electors to switch their vote against Trump. Some Electoral College members were even victims of cyber-bullying and received death threats.

The unusually-high activity surrounding the Electoral College vote was part of a systematic effort to change the normally formal affair into something more fluid — and tip the outcome of November’s election away from Trump, who amassed 306 electoral votes in his stunning win over his Democratic rival Hillary Clinton. She ended up with 232 electoral votes.

A host of B- and C-list celebrities, led by Martin Sheen, even teamed up to beg Republican electors to be “heroes” and vote against Trump.

Former Senator Scott Brown, a Trump surrogate and a frontrunner to be the next head of the Veterans Affairs, called it an effort to “undermine this president-elect and all of the folks that have supported him.”

“I take my job as an elector very seriously, and in Pennsylvania, Donald Trump won,” Mary Barket, a Pennsylvania elector, told the Post Gazette.

“So any argument thereafter, especially about the nature of him being a president, is not going to have an effect on me,” she added.

Democrats have questioned whether Russian hacking of the Democratic National Committee and the emails of Clinton campaign staff members affected the election. Some Democratic electors asked for but did not receive an intelligence briefing before casting their votes Monday.

Polling indicates that American voters believe the Electoral College should accept the will of the people, as expressed in the Nov. 8 presidential election. Forty-six percent say electors should vote for the candidate that won their state, while only 34 percent believe electors should be able to vote for someone else.

The electoral votes won’t be formally tallied until Jan. 6, when Vice President Joe Biden, before a joint session of Congress, is expected to certify the results.

If no one candidate gets the necessary majority to win the presidency — 270 votes — then the House of Representatives will vote on the next president.

The House, of course, is controlled by the Republicans and would then almost certainly give the election to Trump.

Electors are selected by each state to actually cast ballots for the president in the Electoral College.