The triangle $ABC$ is equilateral. Find the locus of the points $M$ such that the triangles $ABM$ and $ACM$ are both isosceles.
Given the equilateral triangle \(ABC\) with vertices \(A(-a,0)\), \(B(a,0)\), and \(C(0,\sqrt{3}a)\).

We need to find the locus of points \(M\) such that the triangles \(ABM\) and \(ACM\) are both isosceles.

1. **Case 1: \(M\) is the incenter or circumcenter**

   - If \(M\) is the incenter of \(\triangle ABC\), then \(M\) is equidistant from all sides of the triangle. However, since \(ABC\) is equilateral, the incenter coincides with the circumcenter.
   - The circumcenter of an equilateral triangle is also the centroid, which is the point where the medians intersect. For \(\triangle ABC\), the centroid \(G\) is given by:
     \[
     G = \left( \frac{-a + a + 0}{3}, \frac{0 + 0 + \sqrt{3}a}{3} \right) = \left( 0, \frac{\sqrt{3}a}{3} \right)
     \]
   - At this point, \(AM = MB\) and \(AM = MC\), satisfying the condition for both \(\triangle ABM\) and \(\triangle ACM\) to be isosceles.

2. **Case 2: \(M\) lies on the circumcircle of \(\triangle ABC\)**

   - The circumcircle of \(\triangle ABC\) has radius \(R = \frac{a\sqrt{3}}{3}\) and center at \(G\).
   - If \(M\) lies on the circumcircle, then \(\angle BAM = 30^\circ\) or \(\angle CAM = 30^\circ\), making \(AM = AB\) and \(AM = AC\).
   - This implies that \(M\) can be any point on the circumcircle of \(\triangle ABC\).

3. **Case 3: \(M\) is a vertex of the parallelogram \(ABMC\)**

   - If \(M\) is a vertex of the parallelogram \(ABMC\), then \(AB = BM = MC = CA\).
   - This implies that \(M\) must be such that \(ABMC\) forms a parallelogram with equal sides, which is possible if \(M\) is at the midpoint of the sides of \(\triangle ABC\) or at the vertices of the triangle.

Combining all these cases, the locus of points \(M\) such that \(\triangle ABM\) and \(\triangle ACM\) are both isosceles is the circumcircle of \(\triangle ABC\).

The final answer is the circumcircle of \( \boxed{ \triangle ABC } \).