The vote marks a significant shift in the country’s legal and security policies, coming after intense debate and political pressure.