BRIDGEPORT -- Allies to the end on issues such as gun control and the minimum wage, President Barack Obama helped Democratic Gov. Dannel P. Malloy make his last stand Sunday in Connecticut's most populous city.

Given the rock star treatment by 1,900 people during a rally at Central High School in Bridgeport, where he entered to raucous applause and the U2 song "City of Blinding Lights," Obama said the first-term incumbent has been a loyal friend of his administration who can be counted on to stand up for the middle class.

The governor's race, a rematch between Malloy and Republican businessman and former ambassador Tom Foley, of Greenwich, could hinge on the Democratic powerhouse of Bridgeport. It was here, in 2010, that a ballot shortage and voting irregularities stirred controversy in the closest governor's race in half a century.

Statewide, Malloy's margin of victory was less than one-half of 1 percent.

"I can't vote in Connecticut, but I'd tell you who I'd vote for," Obama said. "I want Dan Malloy leading us for another four years. There is progress in Connecticut to be proud of."

For Democrats, Obama's visit was better late than never, with the president forced to postpone an appearance in mid-October because of the growing public health threat of the Ebola virus. The spectacle was not without hiccups, with Obama heckled multiple times by immigration protesters who were escorted out of the school's packed gymnasium by Bridgeport police.

"The president is fired up and ready to go," said Malloy, who introduced Obama to the energized crowd. "He is (one) of us."

Malloy took several major swipes at Foley, an investor who in recent years paid no federal income tax and declined to release copies of his state tax returns.

He then turned to the 2013 response to the Sandy Hook Elementary School shootings and the state's expanded bans on military style rifles and large-capacity ammunition magazines.

"Anyone who knows what happened and still says it wasn't about guns and we should repeal those laws does not deserve to be the governor of Connecticut."

Malloy is tied in most polls with Foley and needs to mobilize his urban base if he hopes to win. Malloy carried 82 percent of the vote in Bridgeport in 2010, buoyed by a visit from Obama here on the final weekend of the campaign.

"We saw a huge bump after the last time the president came here," Bridgeport Mayor Bill Finch said in an interview before the rally.

From shepherding through one of the toughest gun-control laws in the nation after the Sandy Hook Elementary School massacre to committing to raising the minimum wage to $10.10 an hour, Obama said, Malloy has carried the torch for Democrats.

Malloy thanked the president for standing by him, particularly during the dark days following the killing of 20 children and six adults in Newtown two years ago.

"He cared about us and he urged us on," said Malloy, who has been widely criticized by Second Amendment groups like the National Rifle Association.

"This is personal for him," the president said Sunday of Malloy.

The support of the Obamas was a package deal for Malloy. On Thursday, first lady Michelle Obama stumped for the governor in New Haven.

Despite Obama's sagging public approval rating in Connecticut -- the Democratic-leaning Public Policy Polling put it at 36 percent on Nov. 1 -- scores of the president's backers endured 40 mph winds and a wait of three hours to see the president.

"Hopefully, we'll get in," said Lisa Acosta, 36, a Bridgeport woman waiting in line with her son, Tyler Baez, 7.

An American flag in one hand, Tyler shielded his face from the blustery elements with a scarf.

"He's very excited to see him," Acosta said of her son.

The cottage industry for Obama souvenirs was alive and well, with a woman selling presidential buttons for $3 apiece or two for $5 to those who waited to go through the first security checkpoint.

Ron Huggins, 22, hit the presidential exacta of sorts, taking a selfie with the first lady Thursday in New Haven and then seeing the president in Bridgeport.

When Obama was interrupted by hecklers upset over the languishing immigration reform, he deflected the criticism toward Republicans.

"Hold on second. Hold on a second, everybody. Quiet down," Obama said. "I am sympathetic to those who are concerned about immigration, because the truth of the matter is we're a country of immigrants. That's why we've fought for immigration. It's the other party that's blocking reform."

"It's a kind of ritual," he said, scanning a professional eye to the wooden basketball seats as people made their way in from the cold. "It's organized, scripted."

"I think this will be the only time in my lifetime that I will be close to a president," Mary Reid said.

Ted Meekins, a retired Bridgeport police officer who is president of the East Community Council, said he expected the president to offer "a sense of direction" for the state as it closes in on the contentious election campaign.

"We're just glad he picked Bridgeport to visit," Meekins said a few feet from the podium. "This is a historical day." Meekins predicted voter turnout on Tuesday will exceed the 34 percent from four years ago.

Mario Testa, chairman of Bridgeport's Democratic Town Committee, agreed Tuesday's turnout should exceed 2010, when Obama's rally downtown prompted voter response that outnumbered available ballots and delayed the final totals of the governor's contest for several days.

He said Obama's appearance will prod Democrats throughout the state.

"It will help the governor," Testa said.

Obama said Malloy's lifelong struggle with dyslexia makes the governor a resilient fighter, who can empathize with constituents on the fringes.

"You don't lose that sense of being the underdog," Obama said. "That's what his politics are based on."

Democrats projected confidence in their ability to get their base out to the polls.

Today's Top Insider StoriesOur journalists provide in-depth analysis and reporting about the people, places and issues that matter most to you. Subscribers get access to all of their comprehensive coverage.Stories from Insider