As a reward for his services Louis XIV appointed him bishop of Strassburg in succession to his brother in 1682, in 1686 obtained for him from Pope Innocent XI the cardinal's hat, and in 1688 succeeded in obtaining his election as coadjutor-archbishop of Cologne and successor to Maximilian. At the instance of the emperor, however, the pope interposed his veto on 26 August 1688; the canons followed the papal lead. Louis XIV attacked the Empire, citing this action as well as his sister-in-law's claim to the inheritance of the Palatinate as his pretexts. As the progress of the Allies against Louis XIV in the Nine Years War deprived him of all prospect of success, Wilhelm Egon retired to France. He retired to his abbey of St-Germain-des-Prés near Paris, where he died on 10 April 1704.