  Fix integers $r\geq 4$ and $i\geq 2$ (for $r=4$ assume $i\geq 3$). Assuming
that the rational number $s$ defined by the equation
$\binom{i+1}{2}s+(i+1)=\binom{r+i}{i}$ is an integer, we prove an upper bound
for the genus of a reduced and irreducible complex projective curve in $\mathbb
P^r$, of degree $d\gg s$, not contained in hypersurfaces of degree $\leq i$. It
turns out that this bound coincides with the Castelnuovo's bound for a curve of
degree $d$ in $\mathbb P^{s+1}$. We prove that the bound is sharp if and only
if there exists an integral surface $S\subset \mathbb P^r$ of degree $s$, not
contained in hypersurfaces of degree $\leq i$. Such a surface, if existing, is
necessarily the isomorphic projection of a rational normal scroll surface of
degree $s$ in $\mathbb P^{s+1}$. The existence of such a surface $S$ is known
for $i=2$ and $i=3$. It follows that, when $i=2$ or $i=3$, the bound is sharp,
and the extremal curves are isomorphic projection in $\mathbb P^r$ of
Castelnuovo's curves of degree $d$ in $\mathbb P^{s+1}$.
