Officially part of the Ottoman empire but free of any organising authority, Algiers became the chief seat of the Barbary pirates. The colourful tale of Ruy Pérez de Viedma, imprisoned by Algerian corsairs during the Battle of Lepanto in 1571, is a fictional parallel to the experiences of Cervantes himself who, while only injured in the battle, was similarly captured some years later. In fact they even share a cell in the 'bagnio', Viedma recalling how he and his fellow prisoners marvelled at the courageous resistance and improbable survival of "a Spanish soldier called something Saavedra" (page 370). The captive also names his captor as one Arnaute Mami, the real-life corsair captain who was reputedly responsible for Cervantes' own imprisonment.
Translator John Ormsby corroborates Cervantes' indirect claims of heroism in his Preface to Don Quixote (1885)