What you're arrested for and what you're prosecuted for are really two totally separate issues. Arresting someone who fought in Syria is pretty reasonable. Finding out that they fought for the Western-backed "good guys" is a great reason to drop the charges, which they did.
Charging him for owning a book is what they did too.