Qitzur Shulchan Arukh – 181:19
A Jew who knows testimony for a non-Jew in a case which [the non-Jew] has against a Jew in their courts, if he would cause the Jew to lose more than he would be obligated in Jewish law, it is prohibited to testify for him. And if not, it is permitted to testify for him. If in the beginning the non-Jew singled out the Jew in order to be his witness, and it would be a desecration of [G-d’s] reputation if he would not testify for him, he should testify for him on any topic.
The issue here isn’t the aiding of a non-Jew at the expense of a Jew, but doing so in a court that doesn’t follow Jewish Law. If the ruling were that the Jew would pay the non-Jew what we believe he truly owes, there is no problem testifying.
As we saw earlier (181:2), there is a chillul Hashem in two Jews going to a civil court rather than a halachic beis din and the Qitzur wrote that such a person really deserves lashes. Here, Rabbi Ganzfried is suggesting a case where a countervailing chillul Hashem would make it permissible to aid the use of civil law even where it hurts a Jew compared to halakhah.