STANFORD — Speaking in the heart of Silicon Valley on Friday, Hillary Clinton accused Facebook, Twitter and Google of enabling Russian agents in a plot to throw the 2016 presidential election to Donald Trump.

She called for the United States to take a hard line on Russian aggression, predicting that the Kremlin would continue its attempts to influence elections as soon as next year — when dozens of congressional seats will be contested.

“Their weapon of choice is not tanks or missiles, but let’s not mince words: This is a new kind of Cold War — and it is just getting started,” the former secretary of state and Democratic presidential nominee told about 500 students at the Stanford Graduate School of Business.

She specifically called out Facebook, Twitter and Google for failing to do more to prevent Russia from influencing the election.

Facebook is “the largest news platform in the world, and with that awesome responsibility they must accept accountability,” she said. Later, she added, “it’s time for Twitter to stop dragging its heels and live up to fact that its platform is being used as a tool for cyberwarfare.”

The three tech companies could not immediately be reached for comment. But in recent weeks, leaders of the companies have acknowledged that Russian actors used their platforms to spread fake news and divisive messages.

In order for the U.S. to defend itself, Clinton said, the Trump administration should adopt a “new doctrine” that “a cyberattack on our vital infrastructure will be treated as an act of war.”

Clinton didn’t claim that Russian influence alone led to her 2016 loss to Trump, calling the election “something of a perfect storm.” But citing new reporting this week that Russian-linked ads on Facebook targeted Michigan and Wisconsin — two of the three decisive states won by Trump — Clinton argued that the Russian effort had a huge impact on the race and was “more sophisticated” than previously believed.

Earlier in the day, Clinton made a less somber appearance in San Francisco for a book-signing event. Several hundred die-hard Clinton fans started lining up outside Books Inc. bookstore at 5 a.m., seven hours before the she was scheduled to arrive.

Many of those who camped out in lawn chairs on Van Ness Avenue knew each other from hundreds of hours of volunteering on Clinton’s presidential campaigns in 2008 and 2016. Decked out in Clinton campaign T-shirts and buttons, they tried not to think too hard about the fact that their hero was signing hardcovers at Books Inc. instead of signing bills in the Oval Office.

“It’s bittersweet,” said Danielle Evans, 39, who wore a “Hill Yeah” T-shirt. She was excited to meet Clinton for the first time, but couldn’t help remembering the depressing election night party she and other volunteers held at Clinton’s San Francisco headquarters on Nov. 8.

“It’s nice to be out here with people who gave their heart to this election, but it’s sad to remember everybody’s heartbreak that night.”

Clinton was met with cheers as she walked into the store around noon. “Hi everybody,” she said with a wave.

The former nominee shook hands and signed books quickly as a coterie of assistants — including Huma Abedin, her closest aide — hustled beaming fans past her table. “Hang in there,” Clinton told one woman who talked about struggling with health insurance. “California has the chance to defeat a bunch of Republican Congress members,” she counseled a former volunteer.

One of her most surprising guests was Mark Murphy, 57, who showed up wearing a jumpsuit covered in photos of Clinton’s face. “I like it a lot!” Clinton told him with a laugh as she shook his hand.

Mark Murphy has been camped out since 5am waiting to meet @HillaryClinton. "I want to tell her thank you and we're going to be behind her." pic.twitter.com/3pb86JI5DR — Casey Tolan (@caseytolan) October 6, 2017

Murphy, who has traveled to meet Clinton several times before, said he had read her book, “What Happened,” and also listened to the audiobook narrated by the candidate. “Her voice is very calming,” he said.

Outside, the Clinton faithful basked in the glow of shaking her hand, and reminisced about her past victories. Susan Dodds, 54, who flew from Seattle to see Clinton, recalled her victory party in Las Vegas after winning the 2016 Nevada primary.

“Now all we have are our memories,” Dodds said.