Ex-PM appears before court