Britain will pay millions to former Guantanamo Bay detainees who say British intelligence agencies helped torture them.