President Obama got a look on Thursday at the muddy wreckage that Hurricane Sandy left in its wake, flying over ravaged neighborhoods in Queens, consoling devastated homeowners under tents and in the streets on Staten Island, and promising a strong and continuing federal role in the recovery.

“We’re reminded that we are bound together and have to look out for each other,” Mr. Obama said after walking down a block that had been all but demolished in the storm.

Mr. Obama, flanked by Gov. Andrew M. Cuomo and Mayor Michael R. Bloomberg, said he wanted federal officials to work with state and local leaders in New York and New Jersey on “a game plan for how we’re going to be able to resource the rebuilding process.”

The president also said he was assigning Shaun Donovan, the secretary of housing and urban development and a former New York City housing official, to oversee the federal recovery effort in the New York area.