Continued from page 1

They defeated a proposal by Sen. Jeff Sessions, Alabama Republican, to build 700 miles of two-tier fencing along the border on a 12-6 vote, and turned back Mr. Cruz’s amendment, by a 13-5 vote, to triple Border Patrol forces and quadruple spending on equipment.

Senators also killed an amendment by Mr. Grassley to require a secure border before immigrant legalization, and by Sen. Mike Lee, Utah Republican, to make Congress have to certify that the border is secure. Both were defeated by 12-6 votes.

Democrats, joined by Mr. Graham and Mr. Flake, said making anything dependent on a vote in Congress is risky, given the record for gridlock.

Lawmakers will return to work Tuesday to begin debating the legalization program and the bill’s rewrite of future legal immigration.

Still to come are major tests such as a Democratic amendment to allow gay couples the same immigration rights as other married couples. The Republicans who negotiated the bill said that would be a deal-breaker, while Democrats said to treat gay couples differently would be unconscionable discrimination.

The bill is almost certain to clear the Judiciary Committee, which is stacked with supporters. It will face a bigger challenge on the Senate floor, where it will need 60 votes to clear, and where some Democrats may join Republicans in opposition.

Overhanging Thursday’s hearing was a lawmaker who wasn’t in the room: Sen. Marco Rubio, a Florida Republican who was a key part of the Gang of Eight. Republicans are counting on him to sell the bill to wary conservatives.

Some Republicans who oppose the bill pointed to Mr. Rubio’s comments that he was willing to do more to secure the border and said that opened the door to their amendments.

Mr. Rubio said he believes the bill will work as written, but he is open to changes if they will earn voters’ confidence.

“I want us to get a consensus on that issue that I’ve outlined, which is this balance between, does Congress dictate to [the Homeland Security Department] specifically what it needs to do on the border, versus allowing them the flexibility — the people on the ground — to decide what the best practices are.”