What is the meaning of the word "rehabilitate"?

Definitions:

  1. help to readapt, as to a former state of health or good repute copy to clipboard verb
    • The prisoner was successfully rehabilitated copy to clipboard
  2. reinstall politically copy to clipboard verb
    • Dead political leaders are often rehabilitated to serve the needs of present politicians. copy to clipboard