Energy extremality in the presence of a black hole