Napoleon Bonaparte was the first emperor of France who revolutionized military organization. The Napoleonic Code established equality under the law and merit-based government jobs. The Napoleonic Wars lasted from 1803 to 1815 across Europe. Napoleon's attack on Russia in 1812 was a complete failure, with only 10,000 of 600,000 soldiers remaining fit for battle. This defeat encouraged his enemies and led to Napoleon's surrender in 1814.