more specifically section 29, 1, (d):
http://www.legislation.gov.uk/ukpga/2000/11/schedule/8/part/...
Though F1 seems to have been edited since i last looked.. still its in theory, unlimited detention without trial.
There is also the Terrorism Act 2006, which i think extended the standard limit to 26 days.. Not sure if this was ever repealed.
https://en.wikipedia.org/wiki/Terrorism_Act_2006