  It is shown that it is possible to consistently and gauge invariantly
formulate models where the coupling constant is a non trivial function of a
scalar field . In the $U(1)$ case the coupling to the gauge field contains a
term of the form $g(\phi)j_\mu (A^{\mu} +\partial^{\mu}B)$ where $B$ is an
auxiliary field and $j_\mu$ is the Dirac current. The scalar field $\phi$
determines the local value of the coupling of the gauge field to the Dirac
particle. The consistency of the equations determine the condition
$\partial^{\mu}\phi j_\mu = 0$ which implies that the Dirac current cannot have
a component in the direction of the gradient of the scalar field. As a
consequence, if $\phi$ has a soliton behaviour, like defining a bubble that
connects two vacuua, we obtain that the Dirac current cannot have a flux
through the wall of the bubble, defining a confinement mechanism where the
fermions are kept inside those bags. Consistent models with time dependent fine
structure constant can be also constructed
