The strength of ECDH public keys with small order
$g$ is a generator and is of order $P$.  Lagrange's theorem says that the order of an element in a group $\mathbb{G}$ divides the order of the group.

In your case, one has $\mathbb{G} = \langle g \rangle$.  Therefore, the order of an element $a = Ag \in \mathbb{G}$ is a divisor of $P$.  If $P$ is a prime, its two divisors are $P$ and $1$.  Hence, either $a$ is of order $P$, either $a$ is of order $1$ (in the latter case, $a$ is the neutral element ---the point at infinity on an elliptic curve given by a Weierstrass equation).