[Physics] Why is there is no electric field outside a thin, grounded, metallic spherical shell enclosing a point charge at center

chargeelectric-fieldselectrostaticsgauss-law

We have a thin, grounded, metallic spherical shell. While solving for its total energy using the formula

$$U_E = \frac{\epsilon_0}{2}\int|\mathbf{E}|^2\,\mathrm d^3r$$

the book I am following says that the electric field outside the shell is zero. But I think Gauss's law doesn't allow that as any spherical Gaussian surface larger than the shell will enclose a net charge of $$q$$.

If the field is indeed zero outside the shell, then the charge at the center must somehow be cancelled. I don't understand how can the grounding of the shell cancel the charge. Can anyone explain why this happens?

As the shell is grounded, charge will move either to or from the ground in order to bring the potential of the shell to zero. Let the shell have net charge $$x$$ on it. Then the potential of shell is given by-
$$V_{total}=V_{shell}+V_q$$ $$V=\frac {kx}r+\frac {kq}r$$ But since $$V=0,\; x=-q$$. This means that $$-q$$ charge will flow from the ground to the shell. Hence if we draw a spherical Gaussian surface at any point outside the shell, the net charge contained inside will be $$q+(-q)$$ which is zero. Hence net electric field will be zero at all points outside the shell.