Spanish inventor and miner Jeronimo de Ayanz is thought to have patented the first steam engine in 1606. It was built to drain flooded mines so that miners could safely work.
While it is often thought that de Ayanz built and patented the first steam engine, credit is actually given to English engineer and inventor Thomas Savery. In 1698, he patented his idea for a machine that would efficiently drain water from mines by utilizing steam pressure.
He developed his idea for his steam machine based on French inventor Denis Papin's plans for the world's first pressure cooker. The invention of the steam engine led to further improvements that were eventually utilized on trains and boats and in industrial settings.