Let $(M,I)$ be an almost complex 6-manifold. The obstruction to integrability
of almost complex structure (so-called Nijenhuis tensor) maps a 3-dimensional
bundle to a 3-dimensional one. We say that Nijenhuis tensor is non-degenerate
if it is an isomorphism. An almost complex manifold is called nearly Kaehler if
it admits a Hermitian form $\omega$ such that $\nabla(\omega)$ is totally
antisymmetric, $\nabla$ being the Levi-Civita connection. We show that a nearly
Kaehler metric on a given almost complex 6-manifold with non-degenerate
Nijenhuis tensor is unique (up to a constant). We interpret the nearly Kaehler
property in terms of G_2-geometry and in terms of connections with totally
antisymmetric torsion, obtaining a number of equivalent definitions. Further
on, we construct an intrinsic diffeomorphism-invariant functional on the space
of almost complex structures on $M$, similar to the Hitchin functional, and
compute its extrema in the following important case. Consider an almost complex
structure $I$ with non-degenerate Nijenhuis tensor, admitting a Hermitian
connection with totally antisymmetric torsion. We show that the intrinsic
volume functional has an extremum in $I$ if and only if $(M,I)$ is nearly
Kaehler.