Within a quasi-geostrophic two-layer model of the wind-driven ocean circulation, an idealized symmetric double gyre flow is considered. When lateral friction is large enough, this flow is steady and characterized by a motionless lower layer. As friction is decreased, the flow undergoes a transition to time-dependence through a Hopf bifurcation, associated with a mixed barotropic/baroclinic instability. It is shown that the nonlinear self-interaction of this oscillatory unstable mode induces a nonzero time mean response in the lower layer. The origin of this deep flow is clarified through a weakly nonlinear analysis near critical conditions. It is explained how the perturbation is associated with both fluxes of anomalous layer thickness and Reynolds' stresses, due to vertical and horizontal phase lags, respectively. Furthermore, it is explained how the patterns of vorticity input, integrated over a cycle of the perturbation, induce a forcing of the second layer. Results deduced from computed trajectories at supercritical conditions support the conclusions from the weakly nonlinear analysis. This time-dependent view of the origin of the deep circulation is complementary to the classical (steady) picture based on the closure of geostrophic contours and forcing by interfacial friction, and may help to interpret results of eddy-resolving numerical models.