I would like to ask for a reference to the following statement (hopefully correct):

Let $M$ be a manifold of sectional curvature at most $1$ and let $\gamma$ be a closed geodesic. Suppose that $\gamma$ is contractible. Then for any contraction of this geodesic at some point its length will be equal to $2\pi$.

It would be even better if there is a reference for the case when $M$ a locally $CAT(1)$ space (not necessarily manifold)