  The problem of finding an optimal curve for the target magnetic axis of a
stellarator is addressed. Euler-Lagrange equations are derived for finite
length three-dimensional curves that extremise their bending energy while
yielding fixed integrated torsion. The obvious translational and rotational
symmetry is exploited to express solutions in a preferred cylindrical
coordinate system in terms of elliptic Jacobi functions. These solution curves,
which, up to similarity transformations, depend on three dimensionless
parameters, do not necessarily close. Two closure conditions are obtained for
the vertical and toroidal displacement (the radial coordinate being trivially
periodic) to yield a countably infinite set of one-parameter families of closed
non-planar curves. The behaviour of the integrated torsion (Twist of the Frenet
frame), the Linking of the Frenet frame and the Writhe of the solution curves
is studied in light of the \Calugareanu theorem. A refreshed interpretation of
Mercier's formula for the on-axis rotational transform of stellarator magnetic
field-lines is proposed.
