Velarde returned to the Artillery College after the war and
worked as an instructor of mathematics and ballistics, in which he became something of
an expert. Like many military men of the period, he harboured great
respect for Napoleon and the French. In 1806
he was made a secretary of the Artillery Corps' Junta Superior Económica
and established himself in Madrid.

When the mass uprisings broke out against the French occupiers
on May 2, 1808, Velarde took up arms and rallied his men. Acting on
orders from the local junta, Velarde led 37 soldiers
to defend the Monteleón artillery barracks against the French. Velarde, along
with his comrade Luís Daoíz de Torres and most of his soldiers,
fell in the day's heavy fighting in which hundreds died. He was 28
years old.

His body was recovered from the battlefield and carried off to a
burial. Velarde's epic last stand, immortalized in artwork and
monuments, assured him a central place in the pantheon of heroes
from the national resistance to Napoleon that has since formed
part of Spain's national mythology.