When he was in prison, people (mostly his brother Mathieu and a high-ranking officer called Picquart) thought he was innocent. They proved that another soldier, Major Esterhazy, was guilty. But the army did not want to admit that it had been wrong. They refused to free him. Finally, the evidence that Dreyfus was innocent became so strong that the government had to demand a new trial. But at the new trial, the army again found him guilty. But the President of France, who did not want an innocent man to suffer any more, pardoned Dreyfus in 1899.
Dreyfus was released. Seven years later, he was officially declared innocent, and allowed back into the army.
The affair divided France into people who thought Dreyfus really was a spy and people who thought he was innocent. Many of those who thought Dreyfus was a spy hated Jews and believed that he was a criminal because he was a Jew, and that a Jew could not be a good Frenchman; this belief is called anti-Semitism. Others thought that the army could not be questioned. The other side believed that an innocent man should not be imprisoned, and feared that Dreyfus's enemies were also enemies of France.