But on the return of Ferdinand VII he was put in prison at Pamplona from 1814 to 1820 . But he was ill rewarded for his services , for on the return of Ferdinand VII he was imprisoned at Pamplona from 1814 to 1820 .