Laser-plasma interactions of ultra-short laser pulses with solid targets can generate highly intense pulses of protons and ions with energies of several MeV. The spectra of these particles are spread over a wide range following a Maxwellian distribution. We report on the design and testing of a magnetic chicane for the selection of protons within a limited energy window. It consists in two successive, anti-parallel dipole fields generated by cost-effective, permanent C-magnets with customized configuration and longitudinal positions. The chicane has been implemented into the target vessel of a petawatt laser facility under constraints on the direction of the incoming laser beam and guidance of the outgoing particles through a vacuum port. The separation of protons and carbon ions within distinct energy intervals has been demonstrated and compared to a ray tracing code.