3. If the equation about $x$
$$
x^{2}-\left(a^{2}+b^{2}-6 b\right) x+a^{2}+b^{2}+2 a-4 b+1=0
$$

has two real roots $x_{1} 、 x_{2}$ satisfying $x_{1} \leqslant 0 \leqslant x_{2} \leqslant 1$, then the range of $a^{2}+b^{2}+4 a+4$ is $(\quad)$.
(A) $\left[\frac{\sqrt{2}}{2}, \sqrt{5}+2\right]$
(B) $[1,9-4 \sqrt{5}]$
(C) $\left[\frac{1}{2}, 16\right]$
(D) $\left[\frac{1}{2}, 9+4 \sqrt{5}\right]$
3. D.
$$
\text { Let } \begin{aligned}
f(x)= & x^{2}-\left(a^{2}+b^{2}-6 b\right) x+ \\
& a^{2}+b^{2}+2 a-4 b+1 .
\end{aligned}
$$

Given that the two roots $x_{1}, x_{2}$ of $f(x)=0$ satisfy $x_{1} \leqslant 0 \leqslant x_{2} \leqslant 1$, we know that $f(0) \leqslant 0, f(1) \geqslant 0$, which means
$$
(a+1)^{2}+(b-2)^{2} \leqslant 4 \text {, and } a+b+1 \geqslant 0 \text {. }
$$

In the coordinate plane $a O b$, the region defined by these two inequalities is such that
$$
a^{2}+b^{2}+4 a+4=(a+2)^{2}+b^{2}
$$

represents the minimum (maximum) value of the square of the distance from the point $(-2,0)$ to any point in the region. The minimum distance is the distance from the point $(-2,0)$ to the line $a+b+1=0$, which is $\frac{\sqrt{2}}{2}$; the maximum distance is the distance from the point $(-2,0)$ to the point on the circle $(a+1)^{2}+(b-2)^{2}=4$, which is $\sqrt{5}+2$.
Therefore, the range of $a^{2}+b^{2}+4 a+4$ is
$$
\left[\frac{1}{2}, 9+4 \sqrt{5}\right] .
$$