Lie algebra with a nilpotent quotient

If $g$ is a finite dimensional Lie algebra. If $h$ is an ideal of $g$ with $g/h$ is nilpotent and $ad_x|_h$ is nilpotent for all $x\in g$. How to show that $g$ is nilpotent?

Let $p:g\rightarrow g/h$ be the canonical projection and $x$ an element of $g$, $ad_{p(x)}$ is a nilpotent endomorphism of $g/h$. This implies that there exists $n$ such that ${ad_{p(x)}}^n =0$. This is equivalent to saying that the image of ${ad_x}^n\subset h$. Since the restriction of $ad_x$ to $h$ is nilpotent, we deduce that there exists $m$ such that ${ad_x}^{n+m}=0$, thus for every $x\in g$, $ad_x$ is nilpotent and henceforth the theorem of Engel implies that $g$ is nilpotent.