Solving a century-long mystery: the origin of galactic cosmic rays