WASHINGTON — President Barack Obama welcomed the World Series champion Red Sox to the White House on Tuesday, praising their victory on the field while hailing them as a symbol of their city’s “grit and resilience” in the wake of last year’s Boston Marathon bombing.

Not all of the ceremonial greeting was quite so serious. David Ortiz, Boston’s best-known player, presented the president with a Red Sox jersey emblazoned with “Obama” and the number 44 on the back, then promptly took a cell phone picture of himself and the chief executive. “What an honor, thanks for the (hash)selfie (at)BarackObama” he quickly tweeted.

And Jonny Gomes, an outfielder, strolled the grounds dressed in a sports jacket that looked like an American flag, stars on one half and stripes on the other.

Standing in front of players and team officials, Obama noted that the Red Sox have won three championships in the past decade, more than any other team.

He said sports sometimes “seems like it’s trivial, it’s just an entertainment. And then, every once in a while, you’re reminded that sports represents something else and it has the power to bring people together like almost nothing else can.”

Three people were killed and more than 260 injured in a bombing at the Boston Marathon. The Red Sox staged a tribute to the victims on the field and had “Boston Strong” symbols sewn into their uniforms. “The point is, Boston and the Red Sox were one,” Obama said.

Obama, a Chicago White Sox fan, wished Boston good luck this season, then added, “May the best Sox win.”