From 2010 until 2011 Castex worked as also chief of staff to health minister Xavier Bertrand in the government of François Fillon.[4] He later suceeded Raymond Soubie and served as Secretary-General of President Nicolas Sarkozy between 2011 and 2012; he was replaced by Emmanuel Macron. In the UMP's 2012 leadership primaries, he endorsed Fillon.[5]