On the day of elections in Arizona, Idaho and Utah, Democratic front-runner Hillary Clinton said terrorist attacks in the Belgian capital show "how high the stakes are" in the 2016 race. Clinton beat rival Bernie Sanders in Arizona. (Sarah Parnass/The Washington Post)

Donald Trump and Hillary Clinton scored easy victories Tuesday in Arizona, the largest and most-watched of the day’s three electoral contests.

Clinton’s roughly 20-point victory came despite voting glitches that appeared to affect Democratic voters more acutely than Republicans, who had submitted mail-in ballots at a higher rate than Democrats. The large margin is a blow to her rival, Sen. Bernie Sanders, who had staked a comeback on Arizona.

Trump won by a decisive 24 percentage points over his nearest competitor, Sen. Ted Cruz (R-Tex.). But Cruz defeated Trump in Utah and took all of the state’s 40 Republican delegates after winning more than 50 percent of the vote.

“Thank you, Arizona!” Trump tweeted soon after the state was called for him, adding a series of hashtags to his post: #Trump2016, #WesternTuesday and #TrumpTrain.

Sanders won handily in Utah and Idaho, but that may have done little to improve his overall standing in delegates against Clinton. Idaho’s caucusing could not begin until everyone who had gotten into line by 7 p.m. local time had entered, prompting many caucuses to start late. The state Democratic Party used its Twitter account, @idahodems, to urge voters to stay in line.

Some Arizona voters waited in line for up to four hours to cast their ballots on March 22. Many took to social media to document their experiences in line, even after the winners were projected. (Jenny Starrs/The Washington Post)

In Utah, many Republican and Democratic caucuses started much later than scheduled as long lines of voters waited to get inside. The state Democratic Party’s website crashed due to high traffic, according to the Associated Press.

The primaries and caucuses came against a backdrop of terror, as voters woke to news of the attacks in Brussels that killed at least 31 people. The Islamic State terrorist syndicate claimed responsibility for the attacks, and the candidates spent much of the day talking about their plans to defeat it.

Clinton called the Arizona victory “exciting” but quickly pivoted to the Brussels attacks. “We live in a complex world. We need leadership that is strong, smart and above all steady,” Clinton said in Seattle. She proclaimed herself the “most ready” to take on that challenge.

Trump had shifted to a heavy focus on illegal immigration and bringing more jobs back to the United States from overseas, but with the terrorist attacks in Brussels on Tuesday, he appeared to once again make fighting terrorism his No. 1 talking point.

Following previous terrorist attacks, Trump has offered some of the most strident proposals — including a temporary ban on allowing most Muslims into the country — and has seen his popularity deepen.

“I have proven to be far more correct about terrorism than anybody — and it’s not even close,” Trump tweeted late Tuesday morning. “Hopefully AZ and UT will be voting for me today!”

Arizona, with 58 Republican and 75 Democratic delegates at stake, was the largest prize in the presidential race Tuesday. Both parties also held contests in Utah, along with Democratic caucuses in Idaho.

People wait in line for the county-wide Democratic caucus in Boise, Idaho, on Tuesday. (Otto Kitsinger/AP)

Trump has significantly lightened his travel schedule since the burst of primaries March 15, when he won in Florida, Illinois and North Carolina.

Trump took two days off the road — his longest break this year — and then held a Friday night rally in Salt Lake City and two rallies in Arizona on Saturday, first in the Phoenix suburbs and then in Tucson. All three attracted protesters, and there were several physical altercations between them and Trump’s supporters. At the rally near Phoenix, protesters temporarily shut down a highway leading to the rally site.

The Republican candidates were supposed to meet for another debate on Monday, but it was canceled when Trump backed out. The candidate instead spent the day in Washington, meeting with The Washington Post editorial board and Republicans on the Hill, then hosting a news conference at his soon-to-open hotel on Pennsylvania Avenue and giving an evening speech to a pro-Israel group.

Clinton’s campaign had expressed confidence about winning here in the most diverse state voting Tuesday, although Sanders had mounted a stiff challenge. Sanders campaigned in the state for four days over the past week and spent heavily on television advertising. Rep. Raúl M. Grijalva (D-Ariz.) narrates one ad, calling Sanders a “change agent” and a politician who has been true to his principles.

Clinton held just one event in Arizona, a boisterous rally in a high school gymnasium Monday, before heading to Washington state, which votes Saturday.

Sanders’s victories in Idaho and Utah were expected. Even Clinton’s campaign manager had predicted as much, but said it is still highly improbable that Sanders can ever catch up to her lead in the delegate count.

Campaigning at a machinists’ union hall in Everett, Wash., Clinton emphasized trade, not immigration, on Tuesday. “I want us to compete and win. That is my goal as president.”

She ignored a protester, saying “this election is too important to be yelling at each other.”

She spoke of the terrorist attacks as a challenge for cooperation among allies, and for new thinking. She took a sidelong swipe at Trump and his pledge to build a wall across the U.S.-Mexico border.

“How high does the wall have to be to keep the Internet out?” she said to laughter. “That’s not the world we live in any longer.”

The Islamic State has been more successful than any other terrorist group in recruiting and radicalizing adherents online.

The Clinton campaign also announced that she will give a speech on terrorism at Stanford University on Wednesday.

Sanders made several unadvertised stops in Flagstaff, Ariz., on Tuesday morning, including at European Coffee House and Brewery and on the campus of Northern Arizona University. He had held a large rally in the mountain town on Monday night.

He issued a statement calling the Brussels attacks “cowardly.”

“Today’s attack is a brutal reminder that the international community must come together to destroy ISIS,” Sanders said, using another name for the Islamic State. “This type of barbarism cannot be allowed to continue.”

Cruz had campaigned hard here. In remarks Tuesday, Cruz slammed Trump for stating he would withdraw the United States from NATO and President Obama for “going to baseball games with the Castros” in Cuba following the Brussels attacks.

Immigration has become one of the top issues of both the Republican and Democratic primaries in Arizona.

Trump has been endorsed by Maricopa County Sheriff Joe Arpaio, whose treatment of prisoners and illegal immigrants has long sparked controversy, and former governor Jan Brewer (R). Brewer signed a bill in 2010 that required the police to determine the immigration status of someone who is arrested or detained if the person is suspected of being in the country illegally, although the Supreme Court struck down parts of the law.

Cruz has been polling ahead of Trump in Utah, which holds caucuses. While Trump has dominated with many Republican voting blocs, his support among Mormons is lagging — and about 62 percent of Utah’s population is Mormon.

If no candidate tops 50 percent in Utah, delegates would be apportioned by voting totals. That would set back one avenue by which Republicans who oppose Trump hope to somehow stop his march.

Cruz’s push in Utah has heavily focused on religious liberty, and he held two campaign events in the past week. On Saturday, he campaigned in the state with TV host Glenn Beck and Sen. Mike Lee (R-Utah), who are both Mormon. He has also been to Phoenix twice and journeyed to the Mexican border, where he accused Trump of hardening his immigration stances just to win the nomination.

Ohio Gov. John Kasich (R) has focused heavily on Utah, holding a series of events in the state on Friday, including a rally in St. George, a heavily Mormon city in the southwest corner of Utah. On Tuesday, Kasich was in Minneapolis.

John Wagner and Katie Zezima contributed to this report.