6. Given in the first quadrant of the Cartesian coordinate plane, there is a regular $\triangle ABC$, which lies within the region (including the boundary) enclosed by the curve $y=-x^{2}+4 a x-3 a^{2}$ $(a>0)$ and the $x$-axis, with the base $BC$ on the $x$-axis. Then, its maximum area function $f(a)$ is _. $\qquad$
6. $f(a)=\left\{\begin{array}{ll}\sqrt{3} a^{2}, & a \geqslant \sqrt{3} ; \\ \frac{\sqrt{3}}{3} a^{4}, & 0<a<\sqrt{3} \end{array}\right.$

The two intersection points of the parabola $y=a x^{2}-2 a^{2} x+a^{3} (a>0)$ with the $x$-axis are $D(a, 0)$ and $E(3 a, 0)$. The vertex is $F\left(2 a, a^{2}\right)$.

Since the base $B C$ is on the $x$-axis, the side length $t$ of the equilateral $\triangle A B C$ is $t \leqslant 2 a$, and the height $h=\frac{\sqrt{3}}{2} t \leqslant a^{2}$. Therefore, $t \leqslant \min \left\{2 a, \frac{2 \sqrt{3}}{3} a^{2}\right\}$. Hence,
$$
\begin{array}{l}
f(a)=\max S_{\triangle A B C}=\min \left\{\sqrt{3} a^{2}, \frac{\sqrt{3}}{3} a^{4}\right\} \\
=\left\{\begin{array}{ll}
\sqrt{3} a^{2}, & a \geqslant \sqrt{3} ; \\
\frac{\sqrt{3}}{3} a^{4}, & 0<a<\sqrt{3} .
\end{array}\right.
\end{array}
$$