Stochastic extremal problems and the strong Markov property of random fields