With his wife and children, he was released on 22 February 1849, in the peace following the Battle of Gujrat, and received the thanks of both houses of parliament and of the governor-general for remaining at his post with such devotion. On 7 June 1849, he was promoted to be brevet lieutenant-colonel and appointed deputy commissioner of Peshawar. The following November, in the capacity of political officer, he accompanied the forces sent under General Bradshaw into the Yusufzai country and was present at the capture of Pullee on the Swat border.