When Petar II Petrović-Njegoš died, the Senate, under the influence of Đorđije Petrović, proclaimed Petar II's elder brother Pero Tomov as Prince. Nevertheless, in a brief struggle for power, Pero, who commanded the support of the Senate, lost to the much younger Danilo who had much more support among people. Prior to the determination of Petar II's successor, after making peace between the Crmnica and Katunjani tribes, and being recognized by all of the Montenegrin clansexcept for the Bjelopavlići, Danilo traveled to Vienna, Austrian Empire and then to the Russian Empire, supposedly to be ordained as Vladika, not Prince. After Danilo returned from Russia in 1852, he took Pero and his supporters by surprise, bringing with him the endorsement from Nicholas I of Russia to become the Prince of Montenegro. Thus somewhat unexpectedly, Danilo became prince and Pero conceded defeat by returning to his position as president of the Senate. After centuries of theocratic rule, Danilo was the first Montenegrin secular prince who did not hold the ecclesiastical position of the Vladika. He was planning to upgrade the status of Montenegro turning it into a kingdom but did not live long enough to see his ambitions realized.
Military successes
It was during Danilo's reign that Montenegro won its most important battle with Turkey and its de facto independence. His charismatic elder brother, Grand Voivode Mirko Petrović-Njegoš led a 7,500 strong army and won the crucial Battle of Grahovac against the Turks on 1 May 1858. The Turkish forces were routed. A considerable arsenal of war trophies was left in the Montenegrins hands, to come handy again in the final wars of independence in 1862 and 1875-8. This major victory had had even more diplomatic significance. The glory of Montenegrin weapons was soon immortalized in the songs and literature of all the South Slavs, in particular the Serbs in Vojvodina, then part of Austria-Hungary. This Montenegrin victory forced the Great Powers to officially demarcate the borders between Montenegro and Turkey, de facto recognizing Montenegro's centuries-long independence. In November 1858, a commission of foreign powers representatives demarcated the border between Montenegro and Turkey. Montenegro gained Grahovo, Rudine, Nikšić's Župa, more than a half of Drobnjaci, Tušina, Uskoci, Lipovo, Upper Vasojevići, and the part of Kuči and Dodoši.
Alliance with Russia and its failure
Danilo I sought in Russia a military ally while trying not to upset Austria. His educated and wealthy wife together with Russia's failure to live up to promise for Montenegro's international recognition of full sovereignty, heavily influenced his Francophile attitude. This Francophile attitude was detrimental to Danilo's relations with Russia, Austria and Serbia, who saw the good relations between Montenegro and France as a threat to their interests. At the same time, all major European powers worked to undermine Russian influence in Southeastern Europe, which was the strongest in Montenegro. Knowing the mood of his people, Danilo refused to compromise on sovereignty of Montenegro averting to the extent the pressure from Europeans. At the same time, Russia was in no position to help Montenegro after suffering a defeat in the Crimean War in 1854. In the subsequent Congress of Paris in 1856, Russian government representatives did not have enough strength to support Montenegrin demands for the independence and territorial enlargement. However, the Russian government replied on Danilo's memorandum "that the Russian government has always recognized Montenegro's independence and will always do so regardless of the position of other great powers". During the trip to France, Danilo received some financial help from France hoping that France would insure the formal recognition of Montenegro's sovereignty. By the same token, Napoleon III hoped that this would bring Montenegro closer to French influence to the expense of the Russia. This act of Danilo earned many enemies since it was seen by many influential Montenegrins as a betrayal of Russia. Danilo's enemies grew in numbers and included Danilo's elder brother, Grand Voivode Mirko and the president of the Senate Đorđije Petrović. The plans to organize the elimination of the Prince were coined by the Montenegrin emigration led by Stevan Perović Cuca and assisted by foreign powers. Danilo's loyals managed to assassinate Perović in Istanbul but the resistance to the Prince was not over.
Danilo's Code
In domestic issues, Danilo was an authoritarian ruler. As it happened, the centralization of his power contributed to development of the modern functions of the state. Danilo used the Law of Petar I Petrović-Njegoš as an inspiration for his own General Law of the Land from 1855. Danilo's Code was based on the Montenegrin traditions and customs and it is considered to be the first national constitution in Montenegrin history. It also stated rules, protected privacy and banned warring on the Austrian Coast. Danilo organized the first census in Montenegro in 1855 and ordered that all Montenegrin households be recorded. According to the census, Montenegro's population was 80,000. Danilo established a tax plan, which was accepted by all tribes of Montenegro and the Hills except the Kuči; out of fear for conflict, Danilo at first did not turn to this problem, until in 1856, when he sent his brother, commander Mirko to punish the Kuči. Some 247 people were killed, and the Kuči were thus forced to pay taxes as did other tribes. Another feud involved the Bjelopavlići clan, but the damage was limited by giving high ranks to the rebel leaders of the clan.
Personal life
On 12 January 1855 at Njeguši he married Darinka Kvekić, who was born in a wealthy Serbian merchant family in Trieste on December 31, 1837 and died on February 14, 1892), daughter of Marko Kvekić and wife Jelisaveta Mirković. They had one daughter, Olga, who never married.
Death and successor
Danilo was assassinated in August 1860, as he was boarding a ship at the port of Kotor. The assassin was Todor Kadić from the Bjelopavlići clan. The Prince Nikola, Danilo's nephew, succeeded Danilo as the next secular Prince of Montenegro.