WASHINGTON — For once, the “four more years” chants at the White House had nothing to do with the president of the United States.

The crowd on the South Lawn on Monday was actually cheering for Stephen Strasburg, the World Series MVP pitcher for the Washington Nationals, who just opted out of the remaining four years on his contract after bringing home the title. The fans, no surprise, would like him signed up for another term.

More than 5,000 of them gathered at the White House to celebrate the first World Series championship in the nation’s capital in 95 years, a marriage of Washington’s two favorite pastimes, politics and baseball. The most unifying force in the city paid a visit on its most divisive force, and while President Trump was not booed in his own house, as he was when he visited Nationals Park last week, several players stayed away, most of them players of color, including the All-Star third baseman Anthony Rendon.

Mr. Trump, who prides himself on counterpunching, opted for grace on this occasion and made no mention of his rough reception or the no-shows. Instead, he lavished praise on a team that came from 12 games under .500 in the spring to win the city’s first baseball title since Calvin Coolidge occupied the mansion on Pennsylvania Avenue — perhaps seeing a little of his own improbable rise to Washington stardom in theirs.