In their first public events since the Aurora, Colo., movie theater shooting that killed at least 12 people and wounded dozens more, President Obama and Mitt Romney set aside their campaign rhetoric Friday and urged Americans to unite at a time of national tragedy.

The two presidential rivals appeared at previously scheduled campaign events in Florida and New Hampshire, two of the most hotly contested battleground states in the November election.

But at neither event was there any sign of the blistering attacks that have marked one of the most negative weeks of the White House race to date.

Nor did either candidate address the issue of gun control, which was forcefully raised separately by such advocates as New York Mayor Michael R. Bloomberg (I) and the Brady Campaign to Prevent Gun Violence.

“There are going to be other days for politics,” Obama told an audience that had gathered for what was originally intended to be a political speech in Fort Myers. “This, I think, is a day for prayer and reflection.” He led the audience in a moment of silence “for the victims of this terrible tragedy,” their loved ones and for “all the victims of less publicized acts of violence that plague our communities every single day.”

Obama then cut short his campaign swing through Florida and returned to the White House to deal with what he called the “senseless” shooting.

He later ordered flags to be flown at half-staff on government buildings and facilities until sunset on July 25.

In Bow, N.H., Romney also opted to forgo a planned campaign speech, instead delivering solemn and spiritual remarks abut the “unspeakable tragedy” in Colorado.

The shooting is a “reminder that life is fragile,” Obama said in a six-minute speech at a convention center full of supporters. “Our time here is limited, and it is precious, and what matters at the end of the day is not the small things, it’s not the trivial things which so often consume us and our daily lives. Ultimately, it’s how we choose to treat one another and how we love one another.”

Displayed at the event were an American flag and bunting, but — as at Romney’s event at a lumber company in Bow — there were no campaign signs, no music, and the mood of the crowd was somber.

“We may never understand what leads anybody to terrorize their fellow human beings like this,” Obama said. “Such violence, such evil, is senseless. It’s beyond reason.”

Obama noted that children, including his own two daughters, often go to the movies. He said he and first lady Michelle Obama would “hug our girls tighter tonight.”

He pledged, “The federal government stands ready to do whatever’s necessary to bring whoever’s responsible for this heinous crime to justice.... We’re going to stand by our neighbors in Colorado during this extraordinarily difficult time.”

After weeks of calling on Romney to release more of his tax returns and hammering him on his tenure at Bain Capital, Obama mentioned neither in his Friday remarks.

In New Hampshire, Romney similarly refrained from pummeling Obama for remarks that Republicans argue show that the president is hostile to small business.

“Our hearts break with the sadness of this unspeakable tragedy, and I join the president and first lady and all Americans in offering our deepest condolences for those whose lives were shattered in a few moments, a few moments of evil in Colorado,” Romney told the crowd of about 120 supporters at Coastal Forest Products Warehouse and Fishing Facility in Bow.

“I stand before you today not as a man running for office but as a father and a grandfather, a husband, and an American,” Romney, the father of five sons, told supporters.

Wearing a dark suit and light blue tie, he spoke under partly cloudy skies and flanked by pine trees, an American flag and bundles of lumber. In his four-minute remarks, Romney said that “today we feel not only a sense of grief, but perhaps also of helplessness.”

“But there is something we can do,” he said. “We can offer comfort to someone nearest to the suffering.... And we can mourn with those who mourn in Colorado.”

Among those attending Romney’s event was Mike Seraikis, 57, an environmental contractor from Concord.

“Look at the video games. What are they? Violence,” he said. “Look at the movies. What are they? Violence.”

Obama was informed of the massacre at 5:26 a.m. in Palm Beach, Fla., by homeland security adviser John O. Brennan, White House press secretary Jay Carney said.

His campaign said later that “in light of the tragedy in Colorado,” Obama was canceling a subsequent event in Winter Park, Fla., and returning to the White House.

Carney told reporters that Obama “wants to be back in Washington to get further updates” on the shooting.

Vice President Biden said: “The reason this is so deeply felt by all Americans is that, but for the grace of God, the victims could have been any one of our children, in any one of our towns. It is every parent’s worst nightmare to receive ‘that phone call’ and to sit by their child’s bedside, praying.”

House Speaker John A. Boehner (R-Ohio) said in a statement: “Confronted with incomprehensible evil, Americans pull together and embrace our national family more tightly. I join President Obama, and every American, in sending my thoughts and prayers to the victims of this awful tragedy. We will all stand with them, as one nation, in the days ahead.”

New York Mayor Michael R. Bloomberg (I) called for tougher gun-control laws. He told WOR radio: “You know, soothing words are nice, but maybe it’s time that the two people who want to be president of the United States stand up and tell us what they are going to do about it, because this is obviously a problem across the country.... I mean, there are so many murders with guns every day, it’s just got to stop.”

Bloomberg added: “No matter where you stand on the Second Amendment, no matter where you stand on guns, we have a right to hear from both of them concretely, not just in generalities — specifically what are they going to do about guns?” He said gun violence is “killing people every day, and it’s growing, and it’s not just an inner-city, East Coast, West Coast, big city phenomenon. Aurora is not a big city.”

Asked about a connection between gun control and the Aurora shooting, Carney said: “As you know, the president believes we need to take common-sense measures that protect the Second Amendment rights of Americans while ensuring that those who should not have guns under existing laws do not get them.... We’re making progress in that regard in terms of improving the volume and quality of information on background checks, but I have nothing additional on that for you. This is obviously a recent event.”

In a strongly worded statement, Dan Gross, president of the Brady Campaign to Prevent Gun Violence, a gun-control advocacy group, said that “we don’t want sympathy” from the president or other elected officials. “We want action.... We are insistent that our elected leaders take action to prevent future tragedies. Political cowardice is not an excuse for evasion and inaction on this life-and-death issue.”

Gross said the shooting rampage was “another grim reminder that guns are the enablers of mass killers and that our nation pays an unacceptable price for our failure to keep guns out of the hands of dangerous people.”

Colorado Gov. John Hickenlooper (D) said in a statement: “This is not only an act of extreme violence, it is also an act of depravity.” But he added, “Coloradans have a remarkable ability to support one another in times of crisis. This one of those times.”

A discordant note came from Rep. Louie Gohmert (R-Tex.), who declared that America’s move away from its “Judeo-Christian beliefs” had caused God to withdraw “his protective hand” from the country.

Gohmert, vice chairman of the House Judiciary subcommittee on crime, terrorism and homeland security, said in a radio interview as he discussed the shooting: “What have we done with God? We told him that we don’t want him around. I kind of like his protective hand being present.”

Sonmez reported from Bow, N.H. Branigin reported from Washington. Philip Rucker in Boston contributed to this report.