But as the counts would not give in the king had to fight them for more than 20 years

Could you correct the punctuation please?
But as the counts would not give in, the king had to fight them for more than 20 years.