I'm trying to understand a proof in Artin's Algebra
"Theorem 15.7.3.b: the irreducible factors of the polynomial $x^{p^r}-x$ over the field $F_p$ are the irreducible polynomials in $F_p[x]$ whose degrees divide $r$.
Proof, converse direction: Let $g$ be an irreducible polynomial over $F_p$ over degree $k$. Suppose $k|r$. Let $\beta$ be a root of $g$ in an extension field of $F_p$ - then $[F_p(\beta):F_p]=k$, so by the subfield criterion $F_{p^r}$ contains a subfield isomorphic to $F_p(\beta)$. Therefore $g$ has a root in $F_{p^r}$, and so $g$ divides $x^{p^r}-x$."
The only step I don't understand is the last one. How does knowing that $g$ has one root in $F_{p^r}$ allow us to deduce that $g$ divides $x^{p^r}-x$?
Note that $g$ and $x^{p^r}-x$ have a common root in $F_{p^r}$. Therefore, they are not relatively prime. So, since $g$ is irreducible, $g\mid x^{p^r}-x$.