You might think that, with decades of experience in dealing with the threat of terrorism, the UK would have learned to avoid the obvious mistakes in rushed legislation that abuses rights and alienates the communities whose support is needed to tackle the issue. Apparently, you’d be wrong.

The terrible attacks in Paris earlier this year illustrated the risk of terrorism in European capitals.

But instead of setting an example by addressing national security threats in a way that is both measured and respectful of rights, the UK government has rushed through a Counter-Terrorism and Security Bill with controversial provisions that threaten human rights and may well prove to be counterproductive.

The most worrying measure in the bill, in its final stage before the upper chamber of Parliament today, will allow the government to ban UK citizens and residents from returning to the UK for up to two years if it suspects that they have been involved in terrorism-related activities abroad.

The measure is a breach of the UK’s duties under international law to not arbitrarily ban people from returning to their own country and to avoid statelessness. Decisions to exclude someone will have to be authorized by a court, but there is an exception for cases the government considers to be “urgent.” And as the parliament’s Joint Committee on Human Rights has pointed out, such exclusion orders are problematic with or without a judicial authorization, and even on a temporary basis.

The bill will also allow police officers to confiscate the passports of people suspected of planning to travel abroad to engage in terrorism-related activities for up to 14 days, and for a maximum of 30 days if a court allows it. But even then, the court will only assess whether the government acted expeditiously, not whether the grounds for seizing the passport were justified. The bill appears to ignore the basic right of everyone to leave any country, which should not be restricted in a sweeping or arbitrary manner.

Though the government has made some improvements to the bill since it was first introduced, it has failed to deliver on its promise of striking the right balance between liberty and security.