Maryland gubernatorial candidate Douglas F. Gansler campaigns during the morning commuter rush at the Grosvenor-Strathmore Metro station in Bethesda on June 4. (Evelyn Hockstein/For The Washington Post)

Twenty-eight minutes into their first televised debate and here came the attack, one that Douglas F. Gansler appeared to expect and even relish from the front-runner in Maryland’s Democratic gubernatorial race.

The state’s highest court, Lt. Gov. Anthony G. Brown told viewers, sanctioned Gansler when he was a county prosecutor “because he – for political gain – spoke out.”

Gansler shot back that the court targeted him because he had once criticized a judge for being too lenient to a child molester. “I wear it as a badge of honor,” Gansler said of the reprimand.

The answer was vintage Gansler, an account delivered with the passion and unyielding certitude that have marked his 16 years as a Maryland prosecutor. Yet those same words also exposed him to a criticism that has trailed him for much of his career: that his rhetoric can be reckless and self-promoting.

An exuberant campaigner who bounds toward voters to greet them, Gansler has never concealed his wish to scale Maryland’s political pyramid.

A child of privilege, he attended elite schools and has raised millions for his campaigns. Yet he has won four elections casting himself as an outsider, a maverick who succeeded despite opposition from the Democratic establishment.

As Montgomery County state’s attorney, he drew attention prosecuting the snipers who terrorized the Washington region. As state attorney general, he won a case before the U.S. Supreme Court that allows police officers to collect DNA evidence when arresting a suspect. He was Maryland’s first statewide politician to champion same-sex marriage.

Yet, as he competes with Brown and state Del. Heather R. Mizeur (Montgomery) in Tuesday’s primary, Gansler has found himself defined by moments when his words — often unvarnished and off-the-cuff — have prompted adversaries and even admirers to portray him as grandstanding and undisciplined.

Early in the campaign, he was criticized for telling supporters that Brown was relying on race in his quest to succeed Gov. Martin O’Malley (D), mocking his rival’s slogan as “ ‘Vote for me, I want to be the first African American governor of Maryland.’ ”

More recently, veterans’ groups complained when Gansler questioned whether Brown’s service in Iraq as a colonel in the Army Reserve had prepared him for a “real job” managing the state.

Gansler “is the victim of his own virtues,” said Matthew Crenson, a retired Johns Hopkins University political science professor. “He has done some pretty courageous things, but that political aggressiveness has also allowed him to say things without too much reflection.

Attorney General Doug Gansler says that when he talks to voters in Maryland, they care less about political party and more about economic issues. (Courtesy Maryland Public Television)

“What you’re seeing is the real Doug Gansler,” Crenson said. “He’s authentic – and that’s his problem.”

If Gansler’s words irritate, he and his supporters say, it’s because he’s bold enough to express what people need to hear. In a campaign ad released Tuesday, he says, “I have a confession. Sometimes I can be blunt. Very blunt.”

He dismisses revelations that have forced him on the defensive — the photo of him at a raucous teen party attended by his son; allegations that he ordered state troopers to drive illegally — as the handiwork of entrenched Democratic forces­ bent on his defeat.

“No one ever thought of me as being irresponsible or reckless until I got into a campaign against Anthony Brown,” Gansler said in an interview. “My character has never been an issue.”

Even as polls show him trailing Brown by a wide margin, Gansler says he would not change anything he has done. “The public appreciates authenticity,” he said. “If you want an empty-suit politician who’s going to regurgitate political-government speak, then I’m not your guy.”

On the campaign trail, he’s all handshakes and schtick, the one-liners rolling off with each new voter he greets.

“Kidney beans for the people!” Gansler shouted, passing out groceries to poor families in Baltimore.

“My man!” he called out to a retired steelworker, noting, “He’s still got two teeth left, which is a good thing.”

“Vote for Gansler!” he said more than once. “He’s a good guy. His mom says so.”

Sideline bravado

At 10 p.m. on a spring Monday, Gansler was on a field in Howard County, his face streaked with sweat and dirt, a lacrosse stick in his hands.

“From the moment you were born, this is the game you were waiting for,” he told his fellow middle-aged amateurs. His tone was playful, his intensity unmistakable.

Gansler has always been this way. At the age of 5, about the time he told his mother that he hoped to become president, he announced he wanted to go to Yale, his father’s alma mater. At 13, he started collecting beer cans, a collection he still curates, storing some 2,000 foreign and domestic empties in boxes in his Bethesda garage. Once, he dragged his wife, Laura, to what is known among aficionados as a “Can-vention.”

His passion for lacrosse led him to start a league for Baltimore kids and coach youth teams around Bethesda, where he earned a reputation as loud and voluble on the sidelines. He angered opposing coaches such as Keith Blizzard, who objected when Gansler shouted, “These guys are no good!” — referring, apparently, to Blizzard’s team of 13-year-olds.

“I walked up to him and said, ‘What about a little discretion here?’ ” recalled Blizzard, 56, a management consultant who has supported Gansler in past campaigns. “And he looked at me, like, ‘Tough luck.’ ”

Gansler’s love of lacrosse began when he was a student at Sidwell Friends School in Northwest Washington, where classmates remember his hallway swagger, athletic prowess and penchant for needling academic stars.

“He talked loud, he stood closer to you than most people, and he was uninhibited,” said Andrew Szanton. “Sometimes he’d say something before he thought it out. People formed very strong opinions of him.”

Jacques Gansler, a high-ranking Defense Department official, helped his son get internships in the U.S. Senate offices of Birch Bayh (D-Ind.) and Bill Bradley (D-N.J.). At Yale, where Gansler made the All-Ivy lacrosse team, his roommate was the son of the political strategist who managed Sen. Gary Hart’s 1984 presidential campaign. Organizing “Yalies for Hart,” Gansler attended the Democratic National Convention that summer in San Francisco, reveling in the excitement.

After law school at the University of Virginia, Gansler was hired as a federal prosecutor in the District. Friends and associates recall him talking about entering politics, sometimes articulating his ambition in the boldest terms.

Raymond Kight, Montgomery County’s former sheriff, said he and Gansler were stuffing envelopes for a political campaign in the mid-1990s when Gansler said, “I’m going to be president one day.”

“And I’m going to be vice president,” Kight recalled teasing. “And he said: ‘Seriously, I will be.’ ” (Asked about Kight, Gansler said, “Is he still alive?” apparently unaware that his campaign’s Web site lists the former sheriff among his supporters. Kight said he has not endorsed anyone in the race.)

Gansler mounted his first campaign in 1998, running for Montgomery state’s attorney against incumbent Robert Dean. “We felt he was an upstart and he should wait his turn,” said Stanton Gildenhorn, Dean’s campaign manager. “The establishment wasn’t happy.”

Then Dean admitted to an extra­marital affair with a former employee who had filed a sex discrimination lawsuit against him. His campaign tanked. At 36, without ever having tried a case in Maryland, Gansler became Montgomery County’s chief prosecutor.

Collateral damage

As state’s attorney, Gansler was a ubiquitous public presence, always willing to stand before cameras and talk about sensational cases: the snipers, boxer Mike Tyson’s road-rage attack, young murder suspect Samuel Sheinbein fleeing to Israel.

At various points, his public comments prompted defense attorneys to seek gag orders in their cases. Gansler tangled with federal prosecutors for control of the sniper case. He caused another stir when he chastised Circuit Court Judge Durke Thompson for sentencing a man to 18 months for sexually assaulting an 11-year-old girl, saying the punishment “was more appropriate for a shoplifter.”

Three years later, the Court of Appeals reprimanded Gansler for statements it said compromised defendants’ right to fair trials in three cases. Although Maryland’s highest court did not cite the sexual assault case, Gansler contended — then and now — that the reprimand was retaliation “because I called out Durke Thompson.”

“I lived this, I know exactly what happened. It was the motive,” he said.

When Gansler pressed the point during the May 7 debate, Brown’s campaign accused him of deceiving voters.

If the controversies hurt Gansler, the damage was not evident when he cruised to reelection in 2002. He was elected attorney general in 2006, again without the support of the Democratic leadership. Two years later, he supported Barack Obama’s presidential campaign, while O’Malley, Brown and the rest of the political establishment lined up behind Hillary Rodham Clinton.

As Maryland’s chief law enforcement officer, Gansler adopted a more-measured tone and made relatively infrequent public appearances. He focused on issues such as pursuing more than $1 billion in mortgage relief for homeowners facing foreclosure.

He promised an “all-out assault” on Chesapeake Bay polluters during his swearing-in but then found that state laws limited his powers. Still, he targeted companies for illegal dumping and chemical spills, and promoted chicken waste as renewable energy.

In 2010, Gansler announced that Maryland would recognize same-sex marriages performed elsewhere. A Republican lawmaker demanded his impeachment, while gay rights activists lauded him. Speculation mounted about whether he’d run for governor.

At his announcement in September, an ally introduced Gansler to a crowd of supporters, praising his “unfiltered candor.”

Three weeks later, The Washington Post reported that state troopers in Gansler’s security detail complained that he had ordered them to break traffic laws when driving him. Gansler denied the allegations.

Then the Baltimore Sun published the photo of Gansler at a Beach Week party attended by his teenage son and dozens of classmates, some of whom said there was underage drinking. As the photo received national attention and comedian Jay Leno mocked him on the “Tonight Show,” Gansler was forced to explain why he hadn’t broken up the gathering.

Reflecting on the incident recently, Gansler said it had not occurred to him, as he arrived at the party, that someone could take a photograph that could damage him. Nor did he express regret.

“I don’t calculate any of this stuff,” Gansler said. “That’s not who I am.”

Confident to the end

On a Thursday night in May, Gansler was at the Washington County Democratic dinner in Hagerstown, where the mayor of Boonsboro — population 3,455 — asked how his campaign was faring.

“If you bring out Boonsboro, it’s all over except for the singing,” Gansler replied.

“We’re in good shape,” he told someone else.

“A single-digit race,” he insisted to a local TV reporter.

He has always defeated candidates he wasn’t supposed to beat, he said. This one will be no different. “We will win,” he promised.

On another day, he visited a largely Jewish neighborhood in a Baltimore suburb, jogging from house to house, dropping bits of Yiddish as he asked for votes.

“I pray to God you get in there,” Joe Markowitz told Gansler between puffs on a cigar.

At another door, an elderly man promised his vote and then apologized for not inviting him in, explaining that “my wife doesn’t have any pants on.”

“That’s what keeps marriages young!” Gansler said, spinning toward the next house, where Ann Grossman led him to her study to show off walls of photos of Bill Clinton and Oprah Winfrey, Golda Meir and Buddy Hackett.

“You’re going on the wall,” Grossman promised Gansler.

But only if he wins.

This is the second of three stories profiling Maryland Democratic gubernatorial candidates Anthony G. Brown, Douglas F. Gansler and Heather R. Mizeur.