Theorem on the primeness of an integer prime in the ring of Gaussian integers I'm trying to understand the proof of the following theorem:

Let $p$ be an integer prime. Then $p$ is either a Gauss prime or the product $\overline{\pi}\pi$ of a Gauss prime and its complex conjugate.
Proof. If $p$ is an integer prime, it is not a unit in $\mathbb{Z}[i]$. So
  $p$ is divisible by a Gauss prime $\pi$. Then $\overline{\pi}$ divides
  $\overline{p}$, and $\overline{p}=p$. So the integer
  $\overline{\pi}\pi$ divides $p^2$ in $\mathbb{Z}[i]$ and also in
  $\mathbb{Z}$. Therefore $\overline{\pi}\pi$ is equal to $p^2$ or $p$.
  If $\overline{\pi}\pi=p^2$, then $\pi$ and $p$ are associates, so $p$
  is a Gauss prime.

I don't get why $\overline{\pi}\pi$ is equal to $p^2$ or $p$? We have $\overline{\pi}\pi\cdot q=p^2$ for an integer $q$. But $\mathbb{Z}$ is a UFD, and $\overline{\pi}\pi\cdot q=p\cdot p$, so we must have $p=\overline{\pi}\pi \cdot u_1$ AND $p=q \cdot u_2$ for $u_1,u_2$ units in $\mathbb{Z}$, i.e., $u_1,u_2=\pm 1$. From here it would follow that $\overline{\pi}\pi=q\cdot u$ for a different integer unit $u$, which is easily seen to be $+1$. Thus $\overline{\pi}\pi=q$. Substituting $\overline{\pi}\pi$ for $q$ in $\overline{\pi}\pi\cdot q=p^2$ yields $\overline{\pi}\pi\cdot\overline{\pi}\pi=p\cdot p$ or $p=\overline{\pi}\pi$. How $\overline{\pi}\pi=p^2$ can be the case? Moreover, if it is the case, I don't understand how one concludes that $\pi$ and $p$ are associates.
 A: $ \pi \bar{\pi} $ is an integer, and since it divides $ p^2 $ in the ring $ \mathbf Z[i] $ (which consists of algebraic integers), we can write $ p^2 = \pi \bar{\pi} z $ where $ z \in \mathbf Z[i] $. But it is easily seen that $ z \in \mathbf Q $, so $ z $ is a rational number that is an algebraic integer. Since $ \mathbf Z $ is integrally closed, this implies that $ z \in \mathbf Z $, so $ \pi \bar{\pi} $ divides $ p^2 $ in $ \mathbf Z $. Now, what (rational) integers do you know that divide $ p^2 $?
If you know that $ \pi \bar{\pi} = p^2 $, then since $ (p/\pi) \cdot (p/\bar{\pi}) = 1 $ and both quantities on the left hand side are algebraic integers, it follows that $ p/\pi $ is a unit in $ \mathbf Z[i] $, and thus $ p $ and $ \pi $ are associated.
A: Starting with the fact that $\pi\overline{\pi}$ divides $p^2$ in $\mathbb{Z}$.  Since $p$ is prime, the only divisors of $p^2$ are $1, p,$ and $p^2$.  It was noted that $\pi$ is not a unit, which leaves $p$ and $p^2$.  If $\pi\overline{\pi}$ is a divisor of $p^2$, it has to be one of those two.
If it turns out that $\pi\overline{\pi}=p^2$, then it's simply the case that $\pi = \pm p$.
