The year 1871 marked the beginning of the German Empire under the Prussian crown. An empire in name, Germany was actually administered by its chancellor Otto von Bismarck, a landed aristocrat (or, Junker) from east Prussia. Though Germany maintained universal manhood suffrage, the Reichstag, the house of Parliament in the German Empire, held only very restricted powers of legislation. Most power remained with Bismarck himself.
Through the 1870s, Bismarck formed expedient alliances with the German center- left parties that had held the majority in German politics since the inception of the empire. These alliances allowed Bismarck to maintain power and thereby establish the main elements of national administration: legal codes, railroad and banking systems, a judicial apparatus, and the civil service structure. In addition, the liberals called on Bismarck's assistance for their anti-Papal campaign, a movement Bismarck was only too happy to lead. Known as the Kulturkampf, or "struggle for civilization", the anti-Church campaign aimed to eliminate Catholics who, Bismarck thought, could never maintain true loyalty to the state because of their higher loyalty to Rome. The legislation of the Kulturkampf removed priests from state service, restricted religious education, elevated civil marriage, and arrested and expelled defiant priests and bishops. Bismarck's attack on the Church was not altogether successful, since it inspired widespread concern over the social fabric of the new state, allowing the Catholic Center party to rally the Catholic vote and other supporters to oppose Bismarck's policies. After his catholic adversaries gained scores of seats in the Reichstag in 1878, Bismarck saw defeat and reached out to the new Pope, Leo XIII, to negotiate a settlement between Germany and the Church. The Kulturkampf ended and Catholic toleration became law.
Without the opposition of the Kulturkampf the Catholic party lost some of its steam, and the powerful Social Democratic Party emerged as Bismarck's key enemy. Led by Eduard Bernstein, the Social Democrats were Marxists who called for a gradual development of the capitalist system into a state socialist system. Among other things, the Social Democrats advocated working within the system to advance the needs of the workers through welfare legislation, trade union power, economic regulation, and nationalization or regulation of industry. Bismarck, recognizing the appeal to Germany's growing working classes, initiated a "carrot and stick" approach of simultaneous repression and an overt effort to acquire popular support. To repress (the stick), Bismarck passed the Anti- Socialist Law, expanding police powers and forbidding socialist meetings, fundraising, and the distribution of printed materials. Police could now arrest any suspected socialist under only a minimum of suspicion. To bring popular support to the state (the carrot), Bismarck pushed extensive social welfare legislation through the Reichstag. The state provided accident insurance, sickness benefits, old age pensions, disability payments, et cetera. However, these moderate reforms did nothing to undermine the growing popularity of the Marxist movement under the Social Democrats. By 1890, the year Kaiser Wilhelm II fired Bismarck, the Social Democrats controlled over twenty percent of the electorate and thirty-five seats in the Reichstag; by 1914, the Social Democrats were the largest single party in German politics.
To keep the Social Democrats in the minority, Wilhelm II required mass conservative support--from the traditional aristocrats to the middle classes and the agrarian poor. Wilhelm found that such a coalition could best be built and maintained through the manipulation of nationalist and militaristic sentiments in the name of an aggressive foreign policy that called for colonial expansion, military development, and espoused German superiority in Europe. Such a system characterized German politics through to the end of World War I.
In 1871, Germany was a new nation; by 1890, Germany was arguably the strongest power on the Continent. Its military, though smaller than that of France or Russia, was the most modern, best equipped, and highly disciplined; its economy was the most vibrant due to its great success at industrialization and technological development; its national integrity was solid and unbreakable due to the importance Bismarck had always placed on loyalty and national improvement. If this was all true, what was Germany's problem? Put less colloquially, why was Germany itching to prosecute a dangerously aggressive foreign policy when its domestic situation was strong and its position in Europe was unrivaled? Let us consider a few possible answers.
As stated above, domestic political concerns could have driven Wilhelm II to pursue a necessarily aggressive foreign policy in order to gain the support of the agrarian poor and middle classes against the Social Democrats. This is entirely possible, though it seems unlikely that Germany would have gone to the lengths that it did--namely, World War I--for political reasons alone.