Miguel de Cervantes Saavedra lived an unsettled life of hardship and adventure. After studying in Madrid (1568-69), he took part in the sea battle at Lepanto (1571) and in 1575 he was captured by pirates. Cervantes spent five years as a slave until his family could raise enough money to pay his ransom. His first play, LOS TRATOS DE ARGEL (1580), was based on his experiences as a Moorish captive. During the next 20 years he led a nomadic existence, also working as a purchasing agent for the Spanish Armada and a tax collector. He suffered a bankruptcy and was imprisoned at least twice, and wrote DON QUIXOTE in prison.