UN chief tells Security Council: Afghanistan ‘hanging by thread’