Federal judge says there may have been an ‘improper motivation’ to bring charges after Salvadoran immigrant sued for his return