Often, the first thing that you need to do is look to the association for consultation and guidance. There are way too many churches where pastors are in similar circumstances and should leave the church. The best way to handle this is to prayerfully approach regarding their career at the church and to address specific problems. If you can't resolve the problems, you should probably fire them for it if there's proper cause. Courts don't intervene on dismissed pastors.
Proper cause is really a spiritual issue.
If the dismissal is handled properly, the courts will not look at the basis for the dismissal. If the association is not responsive, go to the state office. Most state conventions have they can call on to do mediation and arbitration. If the state doesn't have that, then contact LifeWay. They are not familiar with the unique aspects of church discipline and will often give you bad advice.