HEMPSTEAD, N.Y. (AP) -- President Barack Obama sought a steadier showing, while Republican challenger Mitt Romney strove for further political gains in their second of three campaign debates Tuesday night, a nationally televised town hall-style encounter exactly three weeks before Election Day.
Both men rehearsed extensively for the 90-minute encounter, a turnabout for Obama, whose low-energy performance in the first debate nearly two weeks ago sent a shudder through the ranks of his partisans and helped spark a rise in the polls for his rival.
"I had a bad night," the president conceded, days after he and Romney shared a stage for the first time, in Denver. His aides made it known he didn't intend to be as deferential to his challenger this time, and the presidential party decamped for a resort in Williamsburg, Va., for rehearsals that consumed the better part of three days.
Romney rehearsed in Massachusetts and again after arriving on Long Island on debate day, with less to make up for.
"The first debate was huge and we've seen our numbers move all across the country," his wife, Ann, said before joining her husband in New York.
In a campaign filled with controversy, even the evening's ground rules sparked one.
Candy Crowley of CNN, the moderator, said she expected to be following up at times on questions from the audience. A formal memorandum drafted by the two campaigns said her role would be more limited, but she and the evening's sponsor, the Commission on Presidential Debates said they weren't party to it.
The questions were from about 80 undecided voters inside the hall in a deeply Democratic state. But the audience that mattered most watched on television and was counted in the tens of millions. Crucially important: viewers in the nine battlegrounds where the race is likely to be settled.
The topics ranged widely, unlike the first debate, which covered the economy and domestic issues. The final one, next Monday in Florida, will be devoted to foreign policy.
Opinion polls made the race a close one, with Obama leading in some national surveys and Romney in others. Despite the Republican's clear gains in surveys in recent days, the president led in several polls of Wisconsin and Ohio, two key Midwestern battlegrounds where Romney and running mate Paul Ryan are campaigning heavily.
Barring a last-minute shift in the campaign, Obama is on course to win states and the District of Columbia that account for 237 of the 270 electoral votes needed for victory. The same is true for Romney in states with 191 electoral votes.
The remaining 110 electoral votes are divided among the hotly contested battleground states of Florida (29), North Carolina (15), Virginia (13) New Hampshire (4), Iowa (6), Colorado (9), Nevada (6), Ohio (18) and Wisconsin (10).
In a possible preview of his debate strategy, Obama has campaigned in the past several days by accusing Romney of running away from some of the conservative positions he took for tax cuts and against abortion earlier in the year when he was trying to win the Republican nomination.
"Maybe you're wondering what to believe about Mitt Romney," says one ad, designed to remind voters of the Republican's strong opposition to abortion except in cases of rape, incest or when the life of the mother is at stake.
Romney countered by stressing both in person and through his television advertising the slow pace of the economic recovery, which has left growth sluggish and unemployment high throughout Obama's term. Joblessness recently declined to 7.8 percent, dropping below 8 percent for the first time since the president took office.
Romney also has stepped up his criticism of the administration's handling of the terrorist attack against the U.S. Consulate in Benghazi, Libya, more than a month ago that resulted in the death of U.S. Ambassador Chris Stevens and three other Americans.
So far, the Republican challenger has not aired any television advertising on the issue, a suggestion that strategists believe it dims in importance next to the economy.
But the attack sparked one of the sharpest exchanges in last week's vice presidential debate, when Ryan cited it in asserting that the administration's foreign policy was unraveling and Vice President Joe Biden accused his rival of uttering "a bunch of malarkey."
Biden also said that "we" had not been aware of a request for additional security at the facility, a statement that the White House later said applied to the president and vice president.
Secretary of State Hillary Rodham Clinton said Tuesday she accepted responsibility for the level of security assigned to the consulate.
Associated Press writers Julie Pace in New York, Julie Carr Smyth in Columbus, Ohio, and Matthew Lee in Lima, Peru, contributed to this story. Espo reported from Washington.