Promoted colonel, he was British commissioner with the Turkish army in Anatolia in the Russian War of 1854–56, and, having been made a pasha (general/governor/lord) with the degree of ferik (major-general), he practically commanded the Turks during the heroic defence of Kars, repulsing several Russian attacks and severely defeating the Russian general Muraviev in the siege of Kars (not to be confused with the Battle of Kars) on 29 September 1855. Cold, cholera, famine and hopelessness of succour from without, however, compelled Williams to make an honourable capitulation on 28 November following.
A baronetcy with pension for life, the KCB, the grand cross of the Legion of Honour and of the Turkish Medjidie, the freedom of the City of London with a sword of honour, and the honorary degree of DCL of Oxford University, were the distinctions conferred upon him for his valour.
From 1859 to 1864 he held the position of Commander in Chief, North America, and was responsible for preparations for war with the United States in the case that relations broke down. The most severe strain in relations occurring during the Trent Affair.
He became lieutenant-general and colonel-commandant Royal Artillery in 1864, general in 1868, commanded the forces in Canada from 1859 to 1865, held the governorship of Nova Scotia 1865–1867, and the governorship of Gibraltar 1870–1876. He was made GCB in 1871, and Constable of the Tower of London in 1881.