In earlier work, we provided a Hilbert manifold structure for the phase space for the Einstein-Yang-Mills equations, and used this to prove a condition for initial data to be stationary [, Adv. Theor. Math. Phys. 18, 799 (2014)]. Here we use the same phase space to consider the evolution of initial data exterior to some closed 2-surface boundary, and establish a condition for stationarity in this case. It is shown that the differential relationship given in the first law of black hole mechanics is exactly the condition required for the initial data to be stationary; this was first argued nonrigorously by Sudarsky and Wald [Phys. Rev. D 46, 1453 (1992)]. Furthermore, we give evidence to suggest that if this differential relationship holds then the boundary surface is the bifurcation surface of a bifurcate Killing horizon.