Drive system for a vehicle, wherein the drive system comprises an output shaft in a combustion engine, an input shaft, a first electrical machine, comprising a stator and a rotor, a planetary gear comprising three components in the form of a sun wheel, a ring gear and a planetary wheel carrier, wherein the output shaft of the combustion engine is connected to a first of said components in the planetary gear, so that a rotation of such shaft leads to a rotation of such component, wherein the input shaft is connected with a second of said components of the planetary gear, so that a rotation of such shaft leads to a rotation of such component, and wherein the rotor of the electrical machine is connected with a third of said components in the planetary gear, so that a rotation of the rotor leads to a rotation of this component, wherein the drive system also comprises a first locking means, which may be moved between a locked position in which two of said components are locked together, so that the three components rotate with the same rotational speed, and a release position in which the components are allowed to rotate at different rotational speeds, the drive system further comprising a second electrical machine, with a stator and a rotor, connected to the combustion engine's output shaft between the combustion engine and said first component, and a second locking means which may be moved between a locked position, in which the combustion engine's output shaft is locked to the second electrical machine's rotor and said first component, and a release position, in which the output shaft of the combustion engine is disconnected from the second electrical machine's rotor and said first component, and is allowed to rotate independently of these, characterised in that said input shaft is an input shaft of a gearbox, that the drive system comprises at least one control device, adapted to control fuel supply to the combustion engine and to control exchange of electrical power between the first and second electrical machine on the one hand, and on the other hand, at least one electric energy storage device, is present in the drive system, that the control device is adapted to control said locking means (33, 34) to be moved between said locked position and release position and, in order to lock, to control the combustion engine, and/or the first electrical machine, and/or the second electrical machine to achieve the same rotational speed in the parts to be locked together by the respective locking means (33, 34), and, subsequently, to control the locking means to be moved to a locked position, and, in order to release, to control the combustion engine, and/or the first electrical machine, and/or the second electrical machine to achieve torque balance between the parts to be released from each other and, subsequently, to control the locking means to be moved to a release position, and that the control device is adapted to control, when the vehicle is at a standstill with the combustion engine running at idling engine speed, the first locking means is in a release position, and the second locking means is in a locked position, in order to move the vehicle off with power balance, • the first electrical machine to delivery of a torque thereof, so that the requested torque is transmitted to the input shaft of the gearbox, • the combustion engine towards and to its idling speed, • the second electrical machine to deliver a torque, so that the desired power to the energy storage means and electrical loads comprised in the vehicle are achieved, • in case the torque available in the combustion engine at idling speed is insufficient to both counteract the reaction torque from the first electrical machine, and the torque applied from the second electrical machine, to increase the engine speed of the combustion engine, in order to increase the torque available from the combustion engine, and • the first locking means to be moved to a locked position, when the input shaft of the gearbox, the rotor of the first electrical machine and the output shaft of the combustion engine rotate with the same rotational speed. • the first electrical machine to delivery of a torque thereof, so that the requested torque is transmitted to the input shaft of the gearbox, • the combustion engine towards and to its idling speed, • the second electrical machine to deliver a torque, so that the desired power to the energy storage means and electrical loads comprised in the vehicle are achieved, • in case the torque available in the combustion engine at idling speed is insufficient to both counteract the reaction torque from the first electrical machine, and the torque applied from the second electrical machine, to increase the engine speed of the combustion engine, in order to increase the torque available from the combustion engine, and • the first locking means to be moved to a locked position, when the input shaft of the gearbox, the rotor of the first electrical machine and the output shaft of the combustion engine rotate with the same rotational speed.