Lords hands government second terror defeat