Race was a central concern in Boston's 12-way preliminary election for mayor. There was hope, in some quarters, that a black or Latino politician would make it through to the final round — setting up the city to elect its first minority mayor.

Rep. Marty Walsh, left, and City Councilor John Connolly (WBUR File)

But in the end, it was two Irish-American men who emerged: state Rep. Marty Walsh and City Councilor John Connolly.

And now, a different dynamic is taking shape: a tussle between an older, blue-collar Boston and a newer, more affluent city.

Walsh — a longtime labor leader born to immigrant parents and raised in a triple-decker in Dorchester — has positioned himself as a champion of the working class.

Connolly, if reticent about his undergraduate days at Harvard University and work as a lawyer, has sounded themes that appeal to an upwardly mobile city: better public schools, more bike lanes and a City Hall that runs more like an Apple store.

And both candidates' messages, it seems, are meeting their marks.

In Charlestown

Nowhere is the class dynamic more present than in the rapidly gentrifying Charlestown.

The blue-collar Irish who dominated the place for decades — and still maintain a strong presence in many parts of the neighborhood — call themselves Townies.

And they often refer to the wealthier newcomers — crowding the condominiums at the old Charlestown Navy Yard and the renovated row houses by the Bunker Hill Monument — as Toonies.

Many of the Townies are supporting Walsh. Among them: Moe Gillen, a big, affable guy with blue eyes, white hair and a shamrock sticker on his door.

Gillen, who worked at Boston Edison for 37 years, proclaims the virtues of the old neighborhood: a place where "your kids were safe eight streets away because there's somebody that went to school with their mother or their father."

That neighborhood has faded, he says. And the upscale new arrivals are driving up prices. "Some people say that Boston's a better place today," he says. "My question is: better for who?"

Rebecca Love, a nurse practitioner and entrepreneur who grew up in a small town in Michigan and lives just around the corner from Gillen, says she understands why many of the older, blue-collar residents are backing Walsh.

Working-class people, she says, built Charlestown.

But Love, co-president of the Charlestown Mothers Association — which raises money for college scholarships and runs an annual spring egg hunt — is supporting Connolly.

Love says she likes the city councilor's focus on the public schools — a vital institution for young professionals choosing to raise their kids in the city. But she also approves of his focus on Boston's high-tech economy.

"I just see a different vision going forward for Boston," says Love, who is backing Connolly as an individual, not as an officer of the mothers association, "a little bit more innovative."

A Citywide Split

The divide in Charlestown was evident citywide in the preliminary election last month.

Connolly's strength was on the affluent, western edge of the city — starting with his home base in West Roxbury, extending up through Jamaica Plain and into the Back Bay and South End.

Walsh did best in the blue-collar precincts of his native Dorchester and in South Boston — a neighborhood that is gentrifying, but still prefers a more traditional brand of politics.

The white collar-blue collar split is, in some respects, a return to the old order.

Before Mayor Thomas Menino won his first full term in 1993, the fight for the Boston mayoralty was — among other things — a contest between two class-tinged brands of Irish-American politics.

There was the cerebral, lace curtain Irish strain. And there was a more working-class, populist model.

In the first half of the 20th century, James Michael Curley fashioned himself the mayor of the poor — doling out patronage jobs, bending the law and otherwise irritating respectable Boston.

After his defeat, a string of more upscale Irish-American mayors followed, ending with Kevin White: raised in Jamaica Plain and West Roxbury, living in Beacon Hill and possessed of national ambition.

He was hailed as a visionary — eager to make Boston a world-class city again — and criticized as overly patrician. "There was that class thing," recalls Marty Nolan, a former Boston Globe reporter. "'Kevin from Heaven,' 'Kevin Deluxe,' Kevin was putting on airs, according to the people who didn't like him.'"

White's grip on power was not always strong. In 1975, a young Marty Walsh held campaign signs for Joe Timilty, who made an aggressive run at the incumbent mayor. But White won re-election that year — and again four years later.

It wasn't until 1983 that a populist returned to the corner office: Ray Flynn, a son of South Boston who positioned himself as a champion of the neighborhoods.

Walsh puts himself firmly in the blue-collar tradition of Boston politicians.

His father, as he often notes on the campaign trail, was a laborer. "I grew up in a family where my father went to work every day and came home dirty," he says.

Walsh worked briefly in construction, himself. And as a young man he struggled with alcoholism before getting sober and winning a seat in the state Legislature.

Walsh's biography, though, has its liabilities. The longtime labor leader, who stepped down from a post atop the Boston Building Trades to run for mayor, has faced questions about whether he can be trusted to negotiate with city unions.

Connolly's story comes with pitfalls of its own. Raised in a middle class neighborhood in Roslindale — his father was a four-term secretary of state, his mother would become a judge — his story doesn't come with Walsh's pull-up-the-bootstraps appeal.

But Connolly suggests an early recognition that not all Bostonians had the same opportunities inspired a career-long quest for greater equity — including a three-year stint as a teacher in urban schools and a push for sweeping education reform.

"I grew up in a deeply divided city, along race and class lines," he says. "And anyone who lived here in the '70s and '80s remembers just polarizing moments in time and just palpable hatred sometimes ... in the air. And that stays with you. And that drove me to become a teacher and to try to work so everyone could have the educational opportunities I had."

Crossing Lines

It's the sort of language that has allowed Connolly to appeal to voters across class lines — to connect with low-income families, including those in the black and Latino communities shaping up as a major battleground in the mayoral election.

Back in Charlestown, Betty Carrington — a black community activist known to the children of the neighborhood housing projects as "Momma" or "Big Momma" — counts herself as a Connolly supporter.

She met him several months ago when he was going door-to-door. And he reached into his own pocket, Carrington says, when she was organizing a "Unity Day" in August complete with barbecue and a dunk tank.

"The thing about him is he looks you in your eyes — he don't blink, he don't look away — and he tells you just what it is," she says. "This man believes in schools and he believes in children."

Walsh, too, has found a way to break through class barriers.

A decade ago, he played an important, behind-the-scenes role in the state Legislature beating back an attempt to overturn gay marriage — an unlikely role, at the time, for a devout Catholic from Dorchester.

The effort has won him the support of some gay and lesbian activists in the mayoral campaign — and an opening with upscale, liberal voters who might normally be wary of a blue-collar politician with a thick Boston accent.

Walsh may not make large gains on Connolly in Jamaica Plain or the Back Bay. But if he can pick off some of those voters, it could make a difference in a tight race.

Here, the central irony of this campaign: in a race breaking down on class lines, it may be the candidate most adept at crossing those lines who prevails.