Taking advantage of these circumstances a Spanish marine frigate captain, Domingo Monteverde, based in Coro, was able to turn a small force under his command into a large army, as people joined him on his advance towards Valencia. Miranda was left in charge of only a small area of central Venezuela. In these dire circumstances the republican government had appointed Miranda generalissimo, with broad political powers. By mid-July Monteverde had taken Valencia, and Miranda thought the situation was hopeless and started negotiations with Monteverde. On 25 July 1812 Miranda and Monteverde finalized a capitulation in which the former republican areas would recognize the Cortes of Cádiz. The First Republic had come to an end. Monteverde's forces entered Caracas on 1 August.