Let $E$ be an elliptic curve defined over a finite field $F(q)$. Let $G\in E(F(q))$ be a point of order $n$, where $n$ is a prime number and $n>2^{160}$.
The elliptic curve discrete logarithm problem (ECDLP) is the following: given $E, G, Q \in E(F(q))$, determine the integer $l$, $0 \le l \le n-1$, such that $Q = lG$, is computationaly difficult.
My question is:
Why must $n$, the order of basepoint of this elliptic curve, be prime?
Because, if $n$ is not a prime, then there may not exist such an $l$.
To understand this, consider the following simpler situation. Consider the finite group $\mathbb Z/n\mathbb Z$ where $n$ is a prime number. Let $j, k$ be integers such that their congruence classes modulo $n$ are nonzero. Then, if $n$ is a prime number, there always exists an $l$ such that $lj \equiv k\ (\textrm{mod}\ n)$. This is a basic fact and easily follows from Langrange's theorem in group theory. Also for each composite number $n$, you can construct examples of $j,k$ that don't satisfy such an equation.
So $n$ being a prime number makes the situation neater and also contributes to computational complexity -- the composite case can be reduced further depending on prime factorization, which simplification is not possible for numbers which are already primes.