  Let ${\cal E}$ be a Dirichlet form on $L_2(X)$ and $\Omega$ an open subset of
$X$. Then one can define Dirichlet forms ${\cal E}_D$, or ${\cal E}_N$,
corresponding to ${\cal E}$ but with Dirichlet, or Neumann, boundary conditions
imposed on the boundary $\partial\Omega$ of $\Omega$. If $S$, $S^D$ and $S^N$
are the associated submarkovian semigroups we prove, under general assumptions
of regularity and locality, that $S_t\phi = S^D_t\phi$ for all $\phi\in
L_2(\Omega)$ and $t>0$ if and only if the capacity ${\mathop{\rm
cap}}_\Omega(\partial\Omega)$ of $\partial \Omega$ relative to $\Omega$ is
zero. Moreover, if $S$ is conservative, i.e. stochastically complete, then
${\mathop{\rm cap}}_\Omega(\partial\Omega)=0$ if and only if $S^D$ is
conservative on $L_2(\Omega)$. Under slightly more stringent assumptions we
also prove that the vanishing of the relative capacity is equivalent to $S^D_t
\phi = S^N_t \phi$ for all $\phi\in L_2(\Omega)$ and $t>0$.
