A Carleman estimate for degenerate elliptic operators with an application to an ill-posed problem