The Empire managed to gain the diplomatic recognition of several European powers, including Russia, Austria, and Prussia. The United States, however, continued to recognize Juárez as the legal president of Mexico and saw the French invasion as a violation of the Monroe Doctrine, but was unable to intervene due to the American Civil War. Maximilian never completely defeated the Mexican Republic; Republican forces led by Juárez continued to be active during Maximilian's rule. With the end of the Civil War in 1865, the United States began providing more explicit aid to Juárez's forces. Matters worsened for Maximilian after French armies withdrew from Mexico in 1866 in part due to needing to deal with matters closer to home. The Empire collapsed without French aid, and Maximilian was captured and executed by the restored Republican government in 1867.