I'm slightly confused regarding the Maupertuis' Principle. I have read the Wikipedia page but the confusion is even in that derivation. So, say we have a Lagrangian described by $\textbf{q}=(q^1,...q^n)$ of the form $$L = \frac{1}{2} \Big(\frac{d\textbf{q}}{dt}\Big)^2 - V(\textbf{q}).$$ Now we want to define a 'path' P, in the configuration space $\textbf{q}(s)$ parameterized by $s$, which is defined using the following equation $$ds^2:=\sum_{j=1}^n (dq^j)^2$$ with the condition $\textbf{q}(s_f)=\textbf{q}_f$ and $\textbf{q}(0)=\textbf{q}_0$. We now define the integral $$B[P]= \int_0^{s_f}\: ds\: \sqrt{2[V(\textbf{q}(s))-V(\textbf{q}_0)]}.$$
Now I have read that, (source: Erick Weinberg: Classical solutions in QFT Chapter 9 page 179),
'In classical mechanics Jacobi’s principle tells us that for a system described by a Lagrangian of the form mentioned earlier, a path from $q_0$ to $q_f$ that minimizes the above integral $B[P]$ gives a solution of the equations of motion whose time evolution is determined by $\frac{1}{2}\Big(\frac{d\textbf{q}}{dt}\Big)^2 = V(\textbf{q}_0)-V(\textbf{q})$'.
This is the exact statement that I want to prove.
If I prove this then I can verify his other claim that if the path that will minimise $B$ is $\textbf{q}(s)$ then this is the same path that minimises the action integral $S=\int dt L$ with $\textbf{q}(t_0)=\textbf{q}_0$ and $\textbf{q}(t_f)=\textbf{q}_f$. Because I can differentiate the 'energy conservation equation' which will be the Equations of Motion I am familiar with.
So to prove the statement I cannot use the energy conservation equation right? So then I use a similar approach for deriving the Euler-Lagrange equations $$\delta B= \int_0^{s_f} ds \frac{-\sum_j \frac{\partial V}{\partial q^j} \delta q_j}{\sqrt{2[V(\textbf{q}(s))-V(\textbf{q}_0)]}}.$$ Since the $\delta q_j$'s are independent, this gives me $\frac{\partial V}{\partial q_j}=0$ which is incorrect. But I am trying to find where I am going wrong. I am mimicking the Euler-Lagrange equation, thinking of $s$ in some way as $t$ and $L$ as the term in the square root in the expression for B. There are no $\frac{dq}{ds}$ terms and $V(\textbf{q}_0)$ is a constant. To recap I want to derive the energy conservation equation that the path that minimises $B[P]$ should satisfy. Any leads? I suspect there may be something wrong in the way I've set up the question, like a wrong assumption or something.