WASHINGTON—President Barack Obama defended the plan to build a mosque near the site of the 2001 terror attacks in New York, telling Muslim guests at a Ramadan dinner at the White House that the nation's commitment to freedom of religion "must be unshakable.''

Mr. Obama's remarks came after weeks of the White House sidestepping the debate that has roiled New York and the nation since developers announced plans to build a $100 million, 13-story mosque and Islamic cultural center just two blocks from the World Trade Center site.

Opponents, particularly conservatives, have called the proposed mosque an affront to those who died in the attack by Islamist terrorists.

The president, in his prepared remarks for the Friday evening event, said, "I understand the emotions that this issue engenders. Ground Zero is, indeed, hallowed ground.

"But let me be clear: as a citizen, and as president, I believe that Muslims have the same right to practice their religion as anyone else in this country. That includes the right to build a place of worship and a community center on private property in lower Manhattan,'' he said.

The Mosque Controversy

"…This is America, and our commitment to religious freedom must be unshakable,'' Mr. Obama said.

The mosque plan has generated opposition from a host of prominent Republicans, including former New York Mayor Rudy Giuliani and former Alaska Gov. Sarah Palin. Resistance to other mosque-building plans has sprouted around the country, but the symbolism of such a structure in close proximity to Ground Zero has generated a national argument.

New York City Mayor Michael Bloomberg has defended the project, invoking both the city's history of religious tolerance, and the price paid by Sept. 11 victims.

"We do not honor their lives by denying the very constitutional rights they died protecting,'' Mr. Bloomberg said.

The mayor's view, and a vote by the city's landmarks commission to let the project proceed, have done little to damp the opposition. A lawsuit has been filed seeking to stop the project. The two men seeking the GOP nomination for governor of New York have pledged to stop the mosque project if elected.

U.S. President Barack Obama welcomes members of the U.S. Muslim community to a White House Iftar Muslim dinner and supports the prosposed mosque near the site of the September 11, 2001 attacks in New York. Video Courtesy of Reuters.

New York's current governor, Democrat David Paterson, recently suggested he could negotiate an alternative location, but his overture was rejected by mosque planners, and by Mr. Bloomberg.

A Marist College poll found that 53% of New York City voters oppose constructing the mosque near the former site of the World Trade Center. Just 34% favored the plan.

Debra Burlingame, whose brother Charles Burlingame was the pilot of the plane the terrorists hijacked and flew into the Pentagon, said she was furious over the president's remarks.

"I'm so angry. I believe this president has abandoned the American people,'' she said. "This isn't a fight about religious freedom for Muslims. No one has argued they don't have the property rights. This is about a project led by someone who says he's trying to build bridges and bring the community together and he's chosen probably the worst place in America and the worst way to do it.''

Write to Jonathan Weisman at jonathan.weisman@wsj.com