Martin O'Malley with his wife, Katie Curran O'Malley, after announcing he is seeking the Democratic nomination for president. (Photo by Jabin Botsford/The Washington Post)

For months, Martin O'Malley has mulled how to compete with front-runner Hillary Rodham Clinton in the 2016 Democratic presidential nomination.

Now that he's officially a candidate, he also has to worry about Sen. Bernie Sanders (I-Vt.).

Sanders -- a self-described socialist who many party leaders consider an unlikely standard-bearer -- has started to rise in the polls, while O'Malley is hovering in the low single digits. At campaign stops in early states and elsewhere, the firebrand from Vermont is drawing enthusiastic crowds that are several times larger than those that gather for O'Malley.

Burt Cohen, a former state senator from New Hampshire, said he was amazed when 700 people showed up for an event he helped pull together for Sanders at a church in Portsmouth on Wednesday.

"I've been involved in New Hampshire politics for 40 years, and I've never seen anything like it," Cohen said. "It was electric, from start to finish."

Two weeks ago, before deciding to support Sanders, Cohen attended an O'Malley house party in Durham that was one of the former Maryland governor's last public events before he launched his candidacy on Saturday. Most of the 50 people there came away thinking O'Malley could be a good president, Cohen said, and that they would be comfortable with him as the Democratic nominee.

"But the enthusiasm, you can't compare," he said.

After his campaign announcement in Baltimore, O’Malley hit the campaign trail this weekend in both Iowa and New Hampshire, where he was greeted warmly but also faced questions about his place in a Democratic field.

O’Malley drew bursts of applause during an appearance at a union hall in Davenport, Iowa,  as he pledged to strengthen bargaining rights, break up big banks, expand Social Security benefits and fight a trade deal pending in Congress. Reporters seemed most interested, though, in how a candidate riding low in the polls would try to compete not only against Clinton but also Sanders and his uncompromisingly liberal message.

The field is likely to expand further this week with the entry of Lincoln Chafee, the former Rhode island senator and governor, who has criticized Clinton more directly than either O'Malley or Sanders have. Former Virginia senator James Webb is also eyeing the race.

Speaking to reporters in Davenport on Saturday, O’Malley said he brings to the race not only “a fearlessness about my progressive goals” but something else: the accomplishments of running a state and a city.

“I believe I offer this alone among the candidates for the Democratic nomination: I have 15 years of executive experience, of actually getting things done,” he said. “Many of us talk about the things we should do, whether it’s increasing the minimum wage, whether it’s investing more in infrastructure and new industries to create more jobs. I’ve actually done those things.”

About 100 people came to see O'Malley in Davenport, some pledging to support him and others there to compare him with the competition. A crowd of more than 200 joined O’Malley later Saturday for the opening of his state headquarters on the outskirts of downtown Des Moines.

In rainy New Hampshire on Sunday, about 30 patrons -- and a pack of reporters -- were at the Goldenrod Drive-in Restaurant in Manchester when O'Malley arrived. About half the customers were O'Malley supporters, the rest Granite Staters out to get some food or ice cream.

He drew larger crowds at a house party in Gilford and an event for Dartmouth College students in Hanover.

Sanders has been drawing overflow audiences, including a crowd reportedly close to 2,000 who packed into a gymnasium Sunday in Minneapolis, where Sanders vowed that the rich would start paying their fair share of taxes if he's elected president.

Though both Sanders and O'Malley lag far behind Clinton in polls, Sanders's support has jumped while O'Malley's has been stagnant for months. In a recent Iowa poll, for example, Clinton had the support of 61 percent, Sanders 15 percent and O'Malley 3 percent. National polls have been similar.

In Davenport, Democratic activist Sara Riley said that she likes both O'Malley and Sanders -- but doesn't see a scenario in which Sanders actually wins the nomination.

“I would say O’Malley is the alternative to Hillary,” said Riley, a lawyer from Cedar Rapids who had heard O’Malley talk on two previous occasions. “I love Sanders on the issues, but with the exception of some hard-core people who’ll support him no matter what, I think most people want someone who’d be a stronger general election candidate.”

Tom Henderson, chairman of the Polk County Democrats, said he came away impressed with O'Malley's passion during his appearance in Des Moines on Saturday and noted that there is a lot of overlap in the messages of O'Malley and Sanders, including their opposition to the pending Trans-Pacific Partnership trade deal.

"I think the more people see O'Malley, the more they'll like him," Henderson said. "He's still an emerging candidate, while Sanders is better known as a firebrand."

Both Sanders and O'Malley have made attempts in recent weeks to woo the followers of Sen. Elizabeth Warren (D-Mass.), a darling of the party's left, who has insisted she isn't running for president despite efforts to draft her. Polls and other measures suggest Sanders is enjoying more success. The head of the Draft Warren effort in New Hampshire recently went to work for him.

Among those unlikely to switch allegiances from Sanders is Bob Handel, who sat in O’Malley’s audience in Davenport wearing a “Bernie for President” T-shirt.

“We need a political revolution, like Bernie says,” said Handel, who described himself as a semi-retired real estate agent who likes Sanders’s commitment to helping the middle class and the poor.

Jeff Hastings in Manchester, N.H., contributed to this report.