Even after several defeats of the Spanish troops during the Chilean Independence War, Valdivia and Chiloé remained loyal to the Spanish King. By 1820 the newly created Chilean Navy, commanded by Lord Thomas Cochrane, captured Valdivia, but failed to liberate Chiloé. Cochrane's land-based attack took the Spanish by surprise, avoiding a direct confrontation with the highly defended forts at the entrance to the Valdivia River. When loyal troops in Valdivia heard the news about the fall of Corral they sacked the city and fled south to reinforce Chiloé, passing by Osorno.