An active implantable medical device of the cardiac prosthesis type for stimulation, resynchronization and/or defibrillation, comprising: - a ventricular stimulation circuit adapted to deliver low-energy stimulation pulses to an electrode that can be implanted into a heart cavity of a patient; - a capture test circuit adapted to detect a presence or an absence of a contraction of the heart, during a cardiac cycle, subsequent to a stimulation pulse; and - a circuit for adjusting the energy of the stimulation pulses delivered by the stimulation circuit, said adjustment circuit being adapted to independently control a stimulation voltage and a pulse width of the stimulation pulse; wherein the energy adjustment circuit comprises means which implement an iterative algorithm for searching an energetic optimum, which is adapted to modify both the pulse width t and the voltage V of each newly delivered pulse, wherein these means are adapted to implement the following operations at each current iteration: - setting a value { t, V} of high energy, - setting a value { t', V'} of low energy, with t'<t and V'<V, - delivering a stimulation pulse with the value of low energy and performing a capture test, and • in the presence of a capture, ending the current iteration and transitioning to a new iteration, wherein the value of low energy is set as a new value of high energy (B'), • in the absence of a capture, i) applying consecutive counter-stimulation pulses of a pulse width t and a stimulation voltage V set for the value of high energy, ii) ending the algorithm and iii) selecting the last energy value that produced the capture as an optimal energy value. - a ventricular stimulation circuit adapted to deliver low-energy stimulation pulses to an electrode that can be implanted into a heart cavity of a patient; - a capture test circuit adapted to detect a presence or an absence of a contraction of the heart, during a cardiac cycle, subsequent to a stimulation pulse; and - a circuit for adjusting the energy of the stimulation pulses delivered by the stimulation circuit, said adjustment circuit being adapted to independently control a stimulation voltage and a pulse width of the stimulation pulse; - setting a value { t, V} of high energy, - setting a value { t', V'} of low energy, with t'<t and V'<V, - delivering a stimulation pulse with the value of low energy and performing a capture test, and • in the presence of a capture, ending the current iteration and transitioning to a new iteration, wherein the value of low energy is set as a new value of high energy (B'), • in the absence of a capture, i) applying consecutive counter-stimulation pulses of a pulse width t and a stimulation voltage V set for the value of high energy, ii) ending the algorithm and iii) selecting the last energy value that produced the capture as an optimal energy value. • in the presence of a capture, ending the current iteration and transitioning to a new iteration, wherein the value of low energy is set as a new value of high energy (B'), • in the absence of a capture, i) applying consecutive counter-stimulation pulses of a pulse width t and a stimulation voltage V set for the value of high energy, ii) ending the algorithm and iii) selecting the last energy value that produced the capture as an optimal energy value.