4. Given the equation in $x$, $x^{2}-2 a x+a^{2}-4 a=0$ has at least one complex root with a modulus of 3. Then the possible values of the real number $a$ are ( ).
(A) 1,9
(B) $-1,9,2-\sqrt{13}$
(C) $1,9,2+\sqrt{13}$
(D) $1,9,2-\sqrt{13}$
4.D.

Rewrite the equation as $(x-a)^{2}=4 a$.
When $a \geqslant 0$, the equation has real roots, giving $x= \pm 3$, so one root is 3 or -3.
$$
\text { From }(a \pm 3)^{2}=4 a \Rightarrow a=1 \text { or } 9 \text {. }
$$

When $a<0$, we get $x=a \pm 2 \sqrt{|a|} \mathrm{i}$, so $|x|^{2}=a^{2}-4 a=9$, giving $a=2-\sqrt{13}$.