One hundred years ago this month, Tsar Nicholas II of Russia and Kaiser Wilhelm of Germany exchanged a series of telegrams to try to stop the rush to a war that neither of them wanted. They signed their notes “Nicky” and “Willy.”

Cousins who vacationed together, hunted together and enjoyed dressing up in the uniforms of each other’s military officers when sailing on their yachts, these two great-great-grandsons of Paul I of Russia wrote to each other in English, affirming their mutual interests and outlining an agreement that would have resolved the crisis on terms acceptable to both rulers.

Yet only three days after the tsar and kaiser’s initial exchange, Germany declared war on Russia, and World War I was underway. Tragically, these leaders were caught in what Henry Kissinger has called a “doomsday machine”: a network of interlocking alliances and military mobilization timetables that allowed the march of events to overcome their best efforts.

The telegrams between them were discovered by an American journalist in the Russian government archives in 1919 and caused a sensation when they were first published in 1920. A century after they were written, they are vivid reminders of the perils of crisis management — and the wisdom of preventive diplomacy to resolve challenges like today’s territorial dispute in eastern Ukraine before they become crises that suck great powers into confrontations.

The exchange began in the very early morning of July 29, just hours after Austria-Hungary (an ally of Germany) declared war on Serbia (an ally of Russia) in retaliation for the assassination of Austrian Archduke Franz Ferdinand in Sarajevo. Time was short to find a diplomatic solution that would prevent a regional war from becoming a world war.

Tsar Nicholas wrote: “In this serious moment, I appeal to you to help me. An ignoble war has been declared to a weak country. The indignation in Russia shared fully by me is enormous. I foresee that very soon I shall be overwhelmed by the pressure forced upon me and be forced to take extreme measures which will lead to war. To try and avoid such a calamity as a European war I beg you in the name of our old friendship to do what you can to stop your allies from going too far. Nicky.”

Even before this telegram arrived in Berlin, Kaiser Wilhelm sent his own message to the tsar, reading in part: “The persons morally responsible for the dastardly murder should receive their deserved punishment. In this case politics plays no part at all. On the other hand, I fully understand how difficult it is for you and your Government to face the drift of your public opinion. Therefore, with regard to the hearty and tender friendship which binds us both from long ago with firm ties, I am exerting my utmost influence to induce the Austrians to deal straightly to arrive to a satisfactory understanding with you. I confidently hope that you will help me in my efforts to smooth over difficulties that may still arise. Your very sincere and devoted friend and cousin. Willy.”

So from the outset, both leaders expressed hope for a diplomatic solution. And Wilhelm had a particular compromise in mind: Austrian troops would be allowed to advance as far as Belgrade and remain there until Serbia dismantled the Black Hand terrorist group, responsible for the murder of the archduke.

The kaiser told the German chancellor to communicate this proposal to Vienna. But the chancellor privately opposed the “halt in Belgrade” policy and did not deliver the message clearly. Instead, he instructed his ambassador in St. Petersburg to tell the Russian foreign minister that if Russia continued preparing troops for battle against Austria, Germany would also mobilize and “a European war could scarcely be prevented.”

In the next volley of telegrams, sent on the evening of July 29, Wilhelm explained to his cousin why Russia should remain on the sidelines of a limited Austro-Serbian war. Nicholas responded: “Thanks for your telegram conciliatory and friendly. Whereas official message presented today by your ambassador to my minister was conveyed in a very different tone. Beg you to explain this divergency! It would be right to give over the Austro-Serbian problem to the Hague conference. Trust in your wisdom and friendship. Your loving Nicky.”

In this telegram, the tsar made clear that he was still eager to find a diplomatic solution. He endorsed the kaiser’s proposal of negotiations at the Hague, where Germany, Russia, France and England would mediate an agreement between Austria and Serbia. And later that night, because of the messages he was receiving from the kaiser, he resisted the counsel of his war ministers that an immediate mobilization of the entire Russian army was the only plausible response to Austria’s declaration of war. Instead, he issued an order permitting partial mobilization, hoping that this would be viewed less provocatively in Berlin.

Unfortunately, by the next day, both Nicholas and Wilhelm had been overwhelmed by competing views and the momentum of their governments. The tsar accepted his generals’ argument that full mobilization was necessary, because anything less would put his forces at a disadvantage in the event they had to be deployed against Germany. And the kaiser sent a telegram with strong language drafted by the German chancellor: “If, as it is now the case, according to the communication by you & your Government, Russia mobilises against Austria, my rôle as mediator . . . will be endangered if not ruined. The whole weight of the decision lies solely on your shoulders now, who have to bear the responsibility for Peace or War. Willy.”

In the round of telegrams sent on July 31 (which crossed in transmission), neither side proved willing to make concessions or take actions that could have made room for a deal to prevent or delay the outbreak of war.

Kaiser Wilhelm: “I now receive authentic news of serious preparations for war on my Eastern frontier. Responsibility for the safety of my empire forces preventive measures of defence upon me. In my endeavours to maintain the peace of the world I have gone to the utmost limit possible. . . . My friendship for you and your empire, transmitted to me by my grandfather on his deathbed has always been sacred to me and I have honestly often backed up Russia when she was in serious trouble especially in her last war. The peace of Europe may still be maintained by you, if Russia will agree to stop the military measures which must threaten Germany and Austro-Hungary. Willy.”

Tsar Nicholas: “We are far from wishing war. As long as the negotiations with Austria on Serbia’s account are taking place my troops shall not make any provocative action. I give you my solemn word for this. I put all my trust in Gods mercy and hope in your successful mediation in Vienna for the welfare of our countries and for the peace of Europe. Your affectionate Nicky.”

Shortly after that telegram arrived in Berlin, the German chancellor sent an ultimatum to St. Petersburg, giving Russia 12 hours to “suspend every war measure against Austria-Hungary and ourselves.”

The tsar responded to the kaiser: “Understand you are obliged to mobilise but wish to have the same guarantee from you as I gave you, that these measures do not mean war and that we shall continue negotiating for the benefit of our countries and universal peace dear to all our hearts. Our long proved friendship must succeed, with God’s help, in avoiding bloodshed. Anxiously, full of confidence await your answer. Nicky.”

Russia never received that guarantee. Germany saw its ultimatum rejected. The exchange between Nicky and Willy ended on Aug. 1, with the kaiser writing: “I must request you to immediately order your troops on no account to commit the slightest act of trespassing over our frontiers.”

That evening, Germany’s ambassador to St. Petersburg handed the Russian foreign minister a declaration of war and then burst into tears. The last-inning efforts of the cousins clearly failed, and today the legacy of their correspondence is one of missed opportunities. Had the kaiser and the tsar started sooner and been better statesmen, they might have prevented a world war that in the end both of them would lose.

Graham Allison is director of the Belfer Center for Science and International Affairs at Harvard’s Kennedy School of Government.