Charlie Fliegel was at a bar in Los Angeles, watching the Nats clinch the pennant and communing on Twitter with people he would never have come to know if baseball hadn’t returned to Washington. Anthony Williams was at the game, but the former mayor couldn’t walk into the stadium without dozens of people interrupting to thank him for getting the city its team. Tony Kornheiser was on national TV wearing a Nats jacket, a sign of solidarity for a team that didn’t exist when he moved to a city very different from the one he grew up in.

When the Washington Nationals won their first National League championship Tuesday night, after a quick check to ascertain whether hell had indeed suffered a winter weather event, fans who grew up elsewhere and fans who spent a big chunk of their lives wondering whether their town would ever get a baseball team and fans who suffered through the eternal failings of the old Washington Senators all came together in delirious, almost disbelieving celebration.

This is the kind of thing that happens to other cities, not to Washington, where sad-sack sports teams are part of the core identity of the place; not to Washington, the city much of the country loves to hate; not to Washington, the city that’s so often derided as a place that no one is from.

“All those people opposed to building a baseball stadium focused on the spending and the tax revenue, and those are important,” said Williams, who negotiated the return of a baseball franchise to the city in 2004, after 33 years without the sport. “But how do you judge the intangible value of civic unity and the sense of togetherness that the city deeply needed and that baseball has certainly provided?”

The Nationals, the newest name in a sport that puts a premium on history, improbably won their first trip to the World Series by sweeping the ancient and deeply respected St. Louis Cardinals in four games.

Actually, “improbable” doesn’t come close.

The team that won the pennant Tuesday night was, just 15 years ago, a failed Canadian outpost of U.S. professional sports. The Montreal Expos became the Nationals by the narrowest of margins, a 7-to-6 vote of the D.C. Council to use public financing to build an unpopular stadium for an unnamed team in an unknown part of town.

Fourteen years ago, the nascent Washington franchise operated out of a couple of rattling trailers in the parking lot of a rusty, rat-infested stadium that had been abandoned by both its baseball and football tenants. For years, the team was awful, a cellar-dweller that lost 100-plus games per season.

This week’s victory came just eight months after the Nationals lost their marquee player, who signed a mega-contract with the reviled rival Phillies a couple of hours up the interstate. This season began with a losing skid that had even die-hard fans declaring their surrender and calling for the manager’s head.

Even now, an online encyclopedia defines the Nationals simply as “one of two current major league franchises to have never played in the World Series.” (The unrelieved drought is in Seattle.)

And now suddenly misery has flipped to joy. A divided city feels united, if only for a fleeting moment.

“This is catharsis,” said Fliegel, a business strategist in the aerospace industry who has written a Nats blog since the team’s first season. “Finally, they’ve done it. It just connects you to the city. You feel a pride of place through the team. Locals like to point out the difference between ‘Washington’ and ‘D.C.’ — the people who just come here to work and the people who really live here. With the Nats, it doesn’t matter why you’re here. You live here, and you’re welcome.”

There have been more popular teams — the Redskins at their peak owned a day of the week in the most important city in the world. And there have been other championships — hockey’s Capitals captured hearts in their Stanley Cup run two seasons ago, basketball’s Mystics won their first trophy just last week, and D.C. United has been king of Major League Soccer four times.

But because baseball is played every day during its season, it has the capacity to insinuate itself into people’s lives in a more constant way. And at a time when other institutions that once provided the region’s civic glue — the Redskins, Metro, The Washington Post — have struggled or shifted their roles, Washingtonians craved something that could bring people together.

“The Nats have truly grabbed hold of Washington — I’m enchanted and my 33-year-old son’s totally enchanted,” said Kornheiser, who hosts ESPN’s “Pardon the Interruption” and a podcast. “This is a chance for people around the country to see Washington as something other than a dysfunctional, backbiting city.”

Kornheiser moved to Washington in 1979 to write sports columns for this newspaper, arriving from his hometown of New York, where teams come in pairs in each sport.

“I’d never seen anything like the hold the Redskins had on Washington,” he said. “I was looking around for baseball and people said, ‘Oh, that’s up the road.’”

After losing the Senators baseball franchise twice — in 1961 to become the Minnesota Twins and in 1972 to become the Texas Rangers — D.C. fans spent three decades battling I-95 traffic to get to games in Baltimore. Kornheiser went along with the crowd; he even framed his scorecard from the first game at Camden Yards, the Orioles’ spiffy ballpark that opened in 1992.

Even though the Orioles came to depend on Washington fans, the craving for a team of their own nagged at generations of Washingtonians.

For years, Washington boosters pitched the idea that the city was the biggest, richest, best-educated market without a baseball team — the perfect market for a sport that was suffering from mounting attendance problems in several cities. The Senators’ failures had come in a time when the DMV was far less populated, with vastly less disposable income and without one of the country’s busiest transit systems.

For decades, those arguments fell flat. Washington was a loser sports town. Baseball had failed twice. Baltimore was just up the road. Washingtonians weren’t really from there, had no allegiance to the place (never mind that the Redskins at the time were the NFL’s biggest moneymaker).

“There are no real baseball fans in D.C.,” Orioles owner Peter Angelos infamously pronounced in a last-ditch effort to kill the move to Washington in 2004.

When he said that, Angelos’s team was flying high, drawing 2.75 million fans that summer, 12th best in baseball. This year, with his team a shambles on the field, the O’s fell to 1.3 million paying customers, 28th of baseball’s 30 teams.

Bringing baseball to Washington “would be an affront to the Orioles franchise,” Angelos said back then. “Both franchises would drive themselves financially into the ground.”

He was right about his own business. The Nats, not so much: The team drew 2.3 million fans this season, down from the huge numbers that poured out to RFK when baseball first returned to Washington but about average for the sport.

Beyond the games, the stadium has sparked a storm of development, creating one of the region’s most popular entertainment clusters, reviving the Southwest Waterfront and luring more than 10,000 new residents.

“My whole big shtick was: Restore respect to D.C., show that the city’s working, and restore the Anacostia River,” said Williams, who was mayor from 1999 to 2007. “Baseball helped achieve all of those goals, so it’s one of my proudest things.”

The stadium was built, with Williams driving the site choice, along a riverfront that had been the city’s trash heap, a ragtag, largely forgotten hodgepodge of scrap yards, taxi barns, cement plants, sex clubs, vacant lots and abandoned dreams.

Today, a riverfront boardwalk draws families to summertime concerts and water features. Washingtonian magazine Wednesday called the area possibly “the hottest dining neighborhood in D.C.” Where there was one forlorn liquor store and a corner carryout surrounded by empty lots, there are now more than 50 restaurants. Where a few dozen people lived, new high-rise apartment buildings have produced crowded sidewalks and an unusually busy Metro station.

At the Navy Yard station, a block from the ballpark, average weekday traffic has shot up by more than 250 percent since 2007, the year before Nationals Park opened, said Metro spokesman Dan Stessel. Some of that is fans attending games — about a quarter of Nats fans at Tuesday’s game went home by Metro, Stessel said — but most riders are new residents, workers and people going to the new eateries and other amenities.

“Navy Yard has really become a neighborhood unto itself,” he said. “It counters the trend we’ve seen at most stations,” where usage of the subway system has declined in recent years because of extensive repair work, reduced service and competition from ride-hailing apps.

The stadium area has so far generated more than $7 for every dollar the city invested in infrastructure, including about $300 million a year in new tax revenue to the city, according to a study by the Capitol Riverfront business improvement district.

Opponents of the deal to bring the Nats to town argued that the team’s owners should pay all, most or at least some of the massive cost of a stadium. But Major League Baseball, holding all the cards, insisted that the city bear nearly all the risk.

“Voting against the stadium doesn’t mean money will automatically go to schools and other needs,” then-council member and future mayor Adrian Fenty said at the time. “But it does mean that a government that does not get those things right should not be exploring putting hundreds of millions of dollars into the pockets of multimillionaires.”

In the years since, those who opposed the stadium have generally stuck to their positions, noting that every dollar committed to financing the ballpark was therefore unavailable for building schools or libraries. Williams said that not one of the council members who voted against the stadium deal has ever told him they were wrong to do so.

One former council member who insisted on a better deal now says the city was right both to push back against the deal and to finance the stadium. “We just had to make sure the original deal wasn’t outlandish,” Carol Schwartz said. “But it’s absolutely been worth the investment.”

Economists who argue that stadiums are a waste of public dollars still contend that all they achieve is a displacement of entertainment spending from one neighborhood to another.

In the District’s case, however, that displacement has been transformative, because the city depends heavily on spending by suburbanites from Virginia and Maryland. The Nationals say that 80 percent of their fans commute in from the suburbs — 45 percent from Virginia and 35 percent from Maryland — bringing their leisure dollars to the city’s coffers.

Similarly, according to D.C. finance officials and real estate developers, about two-thirds of the new residents of the ballpark area have come not from other parts of the city, but from Virginia, Maryland and beyond.

Receipts from taxes on tickets and food and drinks at the ballpark, as well as the ballpark tax levied on the city’s largest businesses, have run so far ahead of projections that the District expects to pay off the stadium debt upward of 10 years early.

“The Nationals showed people you could come to D.C. and have a good time and be safe,” Williams said. “The idea that this stole from schools and public needs is nonsense. The stadium was part of an investment in the city that brought back our ability to invest in social needs.”

Dave Marsden grew up going “to see the Senators get crushed” at Griffith Stadium, the baseball field in Shaw, where Howard University Hospital now stands. Now, even though he lives in Fairfax, where he is a state senator, he views the Nats as an essential binding agent.

“We all want to be part of a civic community,” Marsden said, “and the Nats free us of all that worry about which tribe we’re in.”