During the Napoleonic era, he served in the Dutch brigade on the French side in the Peninsular War from 1808 to 1810; at the Battle of Ocaña (1809), he was a captain.
Following the restoration of the House of Orange-Nassau in the Netherlands in 1813, he joined the Dutch armed forces with the rank of colonel (as the rank of adjutant general did not exist in the Dutch army).