WASHINGTON — Tens of thousands of immigrants and activists rallied here on Sunday, calling for legislation this year to give legal status to millions of illegal immigrants and seeking to pressure President Obama to keep working on the contentious issue once the health care debate is behind him.

Demonstrators filled five lengthy blocks of the Washington Mall, down the hill from the Capitol where last-minute negotiations were under way on the health care bill. The immigrant activists, chanting Mr. Obama’s campaign slogan of “Yes we can” in Spanish and English, tried to compete with their numbers for public and media attention which were mainly focused on the climactic health care events in the House of Representatives.

The rally brought the return to major street action by immigration activists, who turned out hundreds of thousands of protesters in marches and rallies in 2006. After an immigration overhaul measure was defeated in Congress in 2007, the pace of enforcement raids picked up and many immigrants, especially those without legal status, preferred to lay low.

But immigrant advocates decided to gamble by calling the march, to give a show of force that might impress Mr. Obama and also to vent the frustration of many immigrants who have taken to heart his repeated promises that he would move an immigration bill in Congress by early this year.