8. In $\triangle A B C$, $\angle C=\frac{\pi}{3}$, let $\angle B A C=\theta$. If there exists a point $M$ on line segment $B C$ (different from points $B$ and $C$), such that when $\triangle B A M$ is folded along line $A M$ to a certain position to get $\triangle B^{\prime} A M$, it satisfies $A B^{\prime} \perp C M$, then the range of $\theta$ is $\qquad$
8. $\left(\frac{\pi}{6}, \frac{2 \pi}{3}\right)$.

Let $A H \perp B C$ at point $H$. Then when $A B \perp C M$, $C M \perp$ plane $B A H$. Therefore, $\angle M A H$ is the angle between line $A M$ and plane $A B H$.
$$
\begin{array}{l}
\text { Hence } \cos \angle B A M=\cos \angle B A H \cdot \cos \angle H A M \\
\Rightarrow \cos \angle B A M \leqslant \cos \angle H A M \\
\Rightarrow \angle B A M \geqslant \angle H A M \\
\Rightarrow 0<\angle B<\frac{\pi}{2} \\
\Rightarrow \frac{\pi}{6}<\angle A<\frac{2 \pi}{3} .
\end{array}
$$