Flux stabilization in compact groups