 In 1847 he decided to stand for parliament, and was elected unopposed as Liberal Member of Parliament for Southampton.His speech in the House of Commons on behalf of the government in the Don Pacifico dispute with Greece commended him to Lord John Russell, who appointed him Solicitor-General in 1850 and Attorney General in 1851, a post which he held till the resignation of the ministry in February 1852.Cockburn was born in Alţâna, in what is now Romania and was then part of Habsburg Monarchy, to Alexander Cockburn and his wife Yolande, daughter of the Vicomte de Vignier.