Hillary Clinton lacerated Donald Trump in a much-anticipated foreign policy speech Thursday, effectively launching her general-election campaign by declaring him “temperamentally unfit” to lead the most powerful nation in the world.

In an address that signaled clearly how she plans to defeat Trump in November, Clinton did not delve into the details of her own policies but focused instead on how she views his shortcomings. She framed the real estate magnate with contempt and mockery, and she rejected the central tenet of his campaign — that America is no longer great.

“Donald Trump’s ideas aren’t just different — they are dangerously incoherent,” Clinton said. “They’re not really ideas, just a series of bizarre rants, personal feuds and outright lies.”

Though Clinton still faces a series of final primary contests against Sen. Bernie Sanders of Vermont, she all but declared that the nominating contest is behind her by delivering a 35-minute speech litigating Trump’s qualifications to be president.

She said Trump, against whom she is tightly matched in the latest national polls, is too cavalier about the history of American leadership and responsibility abroad — and too admiring of dictators. He has no regard, she said, for the country’s strategic alliances across the globe and the role they play keeping Americans safe.

At a speech in San Diego, Hillary Clinton said electing Republican rival Donald Trump would be "a historic mistake." Here are key moments from her speech. (Sarah Parnass/The Washington Post)

“Moscow and Beijing are deeply envious of our alliances around the world, because they have nothing to match them,” she said. “They’d love for us to elect a president who would jeopardize that source of strength. If Donald gets his way, they’ll be celebrating in the Kremlin. We cannot let that happen.”

Clinton used the speech to display her easy command of the history and context of American foreign policy and her fluency with the main themes likely to matter to voters this year: terrorism, Russian ambitions, Chinese and North Korean military expansion, Mideast turbulence.

She dismissed Trump statements on subjects such as the NATO alliance and threats from Russia and North Korea. She played Trump’s assertions about climate change for laughs.

But mostly, Clinton presented a sort of courtroom closing argument for why Trump should not be the leader of the world’s largest military and caretaker of an arsenal of nuclear weapons. Often, she did so with biting sarcasm.

“This is not someone who should ever have the nuclear codes — because it’s not hard to imagine Donald Trump leading us into a war just because somebody got under his very thin skin,” she said.

Clinton also sneered at Trump’s Twitter habit, correctly predicting that he would use the social-media platform to attack her during her speech.

“We all know the tools Donald Trump brings to the table: bragging, mocking, composing nasty tweets,” she said. “I’m willing to bet he’s writing a few right now.”

1 of 10 Full Screen Autoplay Close Skip Ad × 10 celebrities who say they’ll leave the U.S. if Donald Trump is elected president View Photos From Jon Stewart to Cher, some said they’d move to Canada, but some preferred another planet. Caption From Jon Stewart to Cher, some said they’d move to Canada, but some preferred another planet. Jon Stewart After the Emmy Awards in September, Stewart was asked whether he’d consider returning to "The Daily Show" if Donald Trump is elected president in 2016. “I would consider getting in a rocket and going to another planet because clearly this planet has gone bonkers," he said. Chip Somodevilla/Getty Images Buy Photo Wait 1 second to continue.

As she spoke, Trump was firing off a series of tweets, including this one: “Bad performance by Crooked Hillary Clinton! Reading poorly from the telepromter! She doesn’t even look presidential!”

At a Thursday evening rally in San Jose, Trump called Clinton’s speech “pathetic” and “sad to watch.”

“It was a political speech — had nothing to do with foreign policy,” Trump said.

Clinton invoked Trump’s own words as her main weapon to demonstrate his unfitness for the job. It’s a likely preview of how she will use what backers think is her best offensive weapon against Trump — his tendency to say and do things that look unpresidential.

One by one, Clinton recited a long list of Trump’s statements on foreign policy issues. Her campaign followed up afterward by blasting out more than three dozen distinct Trump quotations that Clinton had alluded to, with the subject line: “Trump Literally Said All Those Things.”

“He has said he doesn’t have to listen to our generals and ambassadors, because he has quote ‘a very good brain,’ ” Clinton said. “He has said, ‘I know more about the ISIS than the generals — believe me.’ ”

“You know what, I don’t believe him,” she added. “Those are the words, my friends, of someone who doesn’t understand America or the world, and they’re the words of someone who would lead us in the wrong direction.”

Clinton also did something that Trump’s Republican opponents had largely failed to do during their brutal primary season: She took on Trump’s portrayal of the United States as a country in decline.

It is a theme that Trump staked ownership of early, filing an application with the U.S. Patent and Trademark Office just six days after the 2012 presidential election for rights to the phrase “Make America Great Again.”

“America is great — just like we’ve always been,” Clinton declared. “We can be greater still.”

Clinton is freer to make that case than Trump’s erstwhile Republican rivals, who like Trump were arguing that President Obama had harmed the nation. But Clinton may also have learned from one of Obama’s mistakes early in his presidency, when he spoke dismissively of the idea of “American exceptionalism.”

More than a dozen American flags hung behind Clinton as she spoke before a small audience of invited guests in a ballroom at San Diego’s Balboa Park. Before the speech, a recording of the iconic march “Stars and Stripes Forever” replaced the usual playlist of girl-power anthems such as Katy Perry’s “Roar” that usually precede Clinton events.

Trump had sought to rebut Clinton before she even spoke, spending parts of the previous two days criticizing his likely opponent’s temperament and legacy as secretary of state.

“She’s one of the worst secretaries of state in the history of our country,” Trump said Wednesday at a campaign stop in Sacramento. “Now she wants to be our president? Look, I’ll be honest, she has no natural talent to be president.”

Her speech, Trump said, would be full of “such lies.”

Just ahead of the address Trump tweeted, “Crooked Hillary, who I would love to call Lyin’ Hillary, is getting ready to totally misrepresent my foreign policy positions.”

[Hispanic RNC staffer’s resignation spotlights Trump’s toxicity ]

Trump criticized Clinton’s support for the Iraq War when she was a senator and military intervention in Libya when she was secretary of state, policies he also supported. Her Middle East policies as secretary of state left the region worse off, Trump asserted. He said she was “sleeping” during the siege of a U.S. diplomatic post and a CIA site in Benghazi, Libya, that killed four Americans in the closing months of her State Department tenure.

Iraq became a main reason for Clinton’s loss to Obama in 2008. She struggled to defend her support for the American-led invasion at a time when the war was widely considered a quagmire.

Although it has faded as a central campaign issue eight years later, both Trump and Sanders have sought to use her vote as evidence of poor decision-making. Clinton tried to neutralize the issue ahead of this campaign by writing in her State Department memoir that her support had been a mistake she regrets.

Clinton did not mention Sanders in her speech, but it came as she is trying to avoid an embarrassing loss to him in California’s primary on Tuesday. Several polls, including two out Thursday, put Clinton just two points ahead of Sanders in the nation’s most diverse state. That’s within the margin of error, meaning she is tied here — and has to mount a barnstorming effort in the closing days before the primary.

Not to be ignored, Sanders released a statement co-signing on Clinton’s critique of Trump but sharply criticizing her for not “thinking through the consequences” of her support for the Iraq War and for regime change in Libya. “We need a foreign policy based on building coalitions and making certain that the brave American men and women in our military do not get bogged down in perpetual warfare in the Middle East,” Sanders said.

Although she is widely expected to secure the Democratic nomination the same day, when five other states also hold primaries, a loss in California would highlight a central weakness for Clinton — a lack of enthusiastic support from her party’s liberal base and young voters — and potentially hobble her as she enters the general election in earnest.

[What the documentary ‘Weiner’ tells us about Huma Abedin]

Even before Thursday, Clinton and her allies had stepped up the intensity and tempo of attacks on Trump, on foreign and domestic issues. In New Jersey on Wednesday, Clinton hammered Trump and labeled him a “fraud” over the legal controversy surrounding his now-defunct Trump University.

“He is trying to scam America the way he scammed all those people at Trump U.,” she said.

Her tenure as secretary of state may be a target for Trump, but Clinton also believes it is her shield. As secretary of state, her approval rating hit an all-time high of 66 percent, according to a long-running Gallup poll.

Her campaign trotted out a Web video highlighting a range of endorsements of her tenure at the State Department from military and diplomatic figures, including Obama.

Perhaps no Clinton ally’s foray into the 2016 presidential arena is longer awaited than that of Obama, who has increasingly tiptoed into presidential politics in recent days. Speaking in Elkhart, Ind., on Wednesday at a town-hall event hosted by PBS, the president excoriated Trump over foreign policy, echoing themes Clinton would expound on in San Diego the next day.

“He just says, ‘I’m going to negotiate a better deal.’ Well how? How exactly are you going to negotiate that?” Obama said. “What magic wand do you have? And usually the answer is, he doesn’t have an answer.”

Ari Fleischer, a spokesman and aide in the Republican White House of President George W. Bush, said the general election will pit Clinton’s steadiness against Trump’s more unorthodox positions on foreign policy, especially his opposition to interventionism.

“Her strength is her temperament: She is so cautious, so scripted, that she won’t scare people in the knee-jerk way that Donald Trump can scare people,” he said. “Trump, on the other hand, risks knee-jerk scaring people, but he’s against so many of the interventions that many of the American people themselves are against — it’s a real fair fight.”

Phillip and Tumulty reported from Washington.