  Let $\mathfrak{g}$ be a Lie algebra, $E$ a vector space containing
$\mathfrak{g}$ as a subspace. The paper is devoted to the \emph{extending
structures problem} which asks for the classification of all Lie algebra
structures on $E$ such that $\mathfrak{g}$ is a Lie subalgebra of $E$. A
general product, called the unified product, is introduced as a tool for our
approach. Let $V$ be a complement of $\mathfrak{g}$ in $E$: the unified product
$\mathfrak{g} \,\natural \, V$ is associated to a system $(\triangleleft, \,
\triangleright, \, f, \{-, \, -\})$ consisting of two actions $\triangleleft$
and $\triangleright$, a generalized cocycle $f$ and a twisted Jacobi bracket
$\{-, \, -\}$ on $V$. There exists a Lie algebra structure $[-,-]$ on $E$
containing $\mathfrak{g}$ as a Lie subalgebra if and only if there exists an
isomorphism of Lie algebras $(E, [-,-]) \cong \mathfrak{g} \,\natural \, V$.
All such Lie algebra structures on $E$ are classified by two cohomological type
objects which are explicitly constructed. The first one ${\mathcal
H}^{2}_{\mathfrak{g}} (V, \mathfrak{g})$ will classify all Lie algebra
structures on $E$ up to an isomorphism that stabilizes $\mathfrak{g}$ while the
second object ${\mathcal H}^{2} (V, \mathfrak{g})$ provides the classification
from the view point ofthe extension problem. Several examples that compute both
classifying objects ${\mathcal H}^{2}_{\mathfrak{g}} (V, \mathfrak{g})$ and
${\mathcal H}^{2} (V, \mathfrak{g})$ are worked out in detail in the case of
flag extending structures.
