Since Alexander I had no heirs, he left his throne to Nikolai Pavlovich (Nicholas I). The iron will and natural wit allowed Nicholas to rule the country rather effectively. His aim was to strengthen Russia both externally and internally. As the monarch, Nicholas I pursued a very active foreign politics. The was with Turkey (1828 – 1829) resulted in Ottoman army defeat which in turn contributed to the process of the liberation of Greece from Turkish yoke. The wars in Persia and Caucasus, expeditions in Kamchatka and Russian Far East expanded the territory of Russian Empire. It was then that the first Russian railway was put into operation (1837) and the Code of Laws of Russian Empire was written.