Before unification, both Italy and Germany were collections of states: Germany was the German Confederation, with Austria(-Hungary) claiming southern parts of that land, and Italy was much the same situation. Nationalism inspired Otto von Bismarck of Prussia to consolidate the German states under Prussia in wars against Denmark, Austria, and eventually France. Of course, before Bismarck utilized force, there were the popular uprisings in 1848, which led to the formation of a diplomatic party (the Frankfurt Parliament) aiming to create a unified Germany, and unified German peoples. However, the Parliament was dissolved without success, leading to Bismarck’s unification of Germany under Prussia, which declared itself the German Empire in 1871. Italy was in much the same situation, with multiple kingdoms divvying up the land. Count Cavour, acting with the support of the Kingdom of Sardinia, began to occupy and conquer land in the Italian peninsula, eventually leading to Italian unification in 1871 (A coincidence, I believe.) In both of these unification wars, nationalism was what drove the two leaders to consolidate individual states (Although Bismarck’s adherence to that belief is disputed.)