Let $B_t$ be a two-dimensional Brownian motion and $f(x)$ be a bounded measurable function vanishing outside a compact set. Then $(1/\lambda) \int^{e^{\lambda t}}_0 f(B_s) ds$ converges to const. $\ell(M^{-1}(t), 0)$ as $\lambda \rightarrow \infty$, where $\ell(t, x)$ and $M(t)$ are the local time and the maximum process of a one-dimensional Brownian motion, respectively. In the present article we generalize this theorem for more general Markov processes as follows: Let $X_t$ be a Markov process and $f(x)$ be a nonnegative, bounded measurable function on the state space. If the expectation of $\int^t_0 f(X_s) ds$ is asymptotically equal to a slowly varying function $L(t)$ as $t \rightarrow \infty$, then, $(1/\lambda) \int^{L -1(\lambda t)}_0 f(X_s) ds$ converges to $\ell(M^{-1}(t), 0)$ as $\lambda \rightarrow \infty$, in the sense of the convergence of all finite-dimensional marginal distributions.