Consider the Feynman-Kac functional $u(q, D; x) = E_x\exp(\int^{\tau_D}_0 q(x(s)) ds),$ where $D$ is a bounded open region in $R^d, \tau_D$ is the first exit time from $D, q \in C(\bar{D})$, and $x(s)$ is a diffusion process on $R^d$ with generator $L$. We give a criterion for the finiteness or infiniteness of $u(q, D; x)$ in terms of the top of the spectrum of the Schrodinger operator $L_{q, D}$, an extension of $L + q$ acting on smooth functions which vanish on $\partial D$. As we also have a variational formula for the top of the spectrum, we thus obtain a criterion explicitly in terms of a variational formula.