Senators writing a comprehensive immigration bill hope to finish their work this week, opening what’s sure to be a raucous public debate over measures to secure the border, allow tens of thousands of foreign workers into the country and grant eventual citizenship to the estimated 11 million people living here illegally.

Already negotiators are cautioning of struggles ahead for an issue that’s defied resolution for years. An immigration deal came close on the Senate floor in 2007 but collapsed amid interest-group bickering and an angry public backlash.