Let $D$ be a positive integer such that $D-1$ is an odd prime power. In this paper we give an elementary method to find all positive integer solutions $(x, y, z)$ of the system of equations $x^2-Dy^2=1-D$ and $x=2z^2-1$. As a consequence, we determine all solutions of the equations for $D=6$ and $8$.