The legislation's passage ended a week of intense debate and cleared the way for parliament to end Saturday after 158 days.