Given the functional $$F[A]=\int_{\mathbb{R}^3}\{\frac{1}{2\mu(x)}|\nabla\times\vec{A}|^2-\vec{J}\cdot\vec{A}\}d^3x$$ with $\vec{A}$ is a candidate vector potential for the field $\vec{B}=\nabla\times\vec{A}$, $\mu(x)$ a space-dependent permeability and $\vec{J}$ some current distribution, I am asked to show that $F[A]$ takes a minimum value when $\vec{A}$ is a vector potential for the actual magnetic field produced by the current distribution $\vec{J}$ by "completing the square".
This is a problem assigned for a mathematical methods course so not much context is given but this looks like a Lagrangian density of some sort and in previous parts of the problem I was able to vary $\vec{A}$ to show that finding a stationary point leads to establishing Ampere's law and also that $F[A]$ is gauge invariant. The problem that I am encountering here is that I do not quite understand how to complete the square since taking $-\vec{J}\cdot\vec{A}=\frac{1}{2}(\vec{A}-\vec{J})^2-\vec{A}^2-\vec{J}^2$ doesn't seem to help and I can't think of a different way of relating $\vec{A}$ and $\vec{J}$ by a square of some sort. Any help would be appreciated.