David Simon, creator of the television show "The Wire." Simon was born in the District and has lived in Baltimore since his reporting days at the Sun, where he covered crime in the '80s. (Joshua Roberts/Getty Images for the MacArthur Foundation)

Maryland Gov. Martin O’Malley (D) recently found himself stuck in an Amtrak train car with David Simon, the creator of “The Wire,” that popular HBO show about Baltimore’s drug trade, broken education system and corruption at all levels that includes a philandering, crime-stats-fudging fictional mayor who just happens to have had the same political trajectory as O’Malley.

So, uh, what happens next?

First, some background on just how much O’Malley hates — no, loathes — the show: After the first season aired, Simon said he received an angry phone call from O’Malley, then mayor of Baltimore, who raised concerns about how his city was being shown and threatened to block the filming of Season 2. O’Malley has challenged anyone who calls him an inspiration for the show, saying on MSNBC in 2009: “I’m the antidote to ‘The Wire.’” Even now, years after the series ended in 2008, aides and staffers know not to mention it around him.

Fictional Mayor Tommy Carcetti was based on several politicians, including O’Malley, Simon told the Daily Beast last year.

“The writing was not unsympathetic to a man who comes in with the idea of changing things and emerges a completely different creature,” Simon said in the interview. “That was the story [of Tommy Carcetti] and that is the story of Marty O’Malley.”

As an Acela Express train left New York last week, Simon noticed the governor sitting at the four-top table behind him, Simon wrote on his blog,”The Audacity of Despair,” on July 18. (The post was first spotted by Baltimore Magazine.)

Just south of Philadelphia, Simon texted his 20-year-old son: “On the southbound Acela. Marty O’Malley sitting just behind me.” He added this joke: “Do I set it off?”

Simon, a former Baltimore Sun reporter, said that his son offered a more diplomatic approach: “Buy him a beer.”

Simon waited until they passed Wilmington, noticed that O’Malley was sipping a Corona and went to the cafe car to buy him another.

“I came back, put it on the table next to its mate, and said, simply, ‘You’ve had a tough week,’” Simon wrote on his blog. “My reference, of course, was to the governor’s dustup with the White House over the housing of juvenile immigrants in Maryland, which became something of a spitting contest by midweek.”

A few minutes later, O’Malley — now contemplating a run for the White House in 2016 — beckoned to Simon, smacking the seat next to him. (Aides to the governor confirmed the trip but would not comment on the encounterwith Simon.)

”We’re getting to be old men at this point,” O’Malley said, according to Simon. “Sit, talk.”

What did the two talk about?

“He still hates ‘The Wire’ with a taut fury,” Simon wrote, adding that he is “still no fan” of some O’Malley policies.

But the two found other stuff to discuss: The governor’s spat with the White House, memories of “farcical personages who once held court on the Baltimore City Council” and their mutual love of the Pogues, a Celtic punk band from London.

“At one point, we both lamented the death last year of Pogues guitarist Phil Chevron and sang some lyrics to Chevron’s magnificent ‘Faithful Departed,’” Simon wrote. “This no doubt brought a vague nausea to the aide traveling with the governor and anyone else still awake in our vicinity.”

The two former archenemies joked about how they both might suffer from Irish or Jewish Alzheimers — where you only remember the grudges. Then they snapped a selfie on the governor’s iPad, shook hands and parted ways.