A rivalry between two princes may explain Saudi Arabia’s sudden eagerness to pick fights at home and abroad, as the two men spark one international disaster after another while vying for the kingdom’s throne.

"To understand the Saudi royal family, you don't go to the Kennedy School of Government," says Bruce Riedel, the CIA's former national intelligence officer for the Middle East. "You read Shakespeare!"

The struggle between Crown Prince Muhammad bin Nayef and Prince Mohammad bin Salman has all the elements of Elizabethan drama, including strange alliances, ambitious courtiers – and an ailing, ancient king who may be mentally incompetent.

Diplomatic sources and U.S. officials believe 80-year-old King Salman, with whom Secretary of State John Kerry is scheduled to meet in Riyadh this weekend, shows signs of dementia. One official said that during a recent meeting, the king was only able to follow the conversation by pausing while an aide in another room typed a response that the king then read from an iPad. Some in the U.S. government believe that when King Salman declined to come to Camp David last spring to meet with President Obama, he was not just snubbing the president but trying to avoid embarrassment in front of world media.

The princes who would take his place may be first cousins, but they’re polar opposites. “MBN,” as Crown Prince Muhammad bin Nayef is known, is 55 and a trusted U.S. ally. The interior minister and crown prince rose to power on his slow, steady success as head of the Saudi counterterrorism program, where he became a favorite of the CIA. He was sometimes also known as the Prince of Darkness because of his rank, his job in intelligence, and his night-owl habits.

Saudi King Salman bin Abdulaziz salutes the Kingdom's national anthem as he arrives to inaugurate the works of the Shura Council in Riyadh. Photo was made available on Dec. 23, 2015. Saudi Press Agency / Handout

“MBS,” Mohammad bin Salman, is King Salman’s son. Just 29, he’s the defense minister and a savvy publicity hound who shot to prominence in 2015 as the architect of Saudi Arabia’s war against Yemen’s Houthi rebels .

"Bin Salman is a pop idol," notes Riedel, who is now at the Brookings Institution. "His picture is all over Saudi social media, on television, on billboards. There are pop music songs about him!"

Bin Salman’s trips to Russia, France and the U.S. were heavily covered in Saudi papers and burnished his image with the huge chunk of the kingdom’s population that is under 30. "They can see themselves in him,” said Riedel. “The system didn’t normally operate that way."

U.S. officials say the younger generations of the Saudi public seem energized by bold action, and the princes are competing for public favor by seeing who can take the most aggressive stance towards the nation’s internal and external enemies. But their bold actions have brought risk and ruin. The byproducts of their power struggle now include mounting tension with Iran, an increasingly costly military quagmire in Yemen, and protests by Shiites around the world.

Last month’s beheading of Nimr al-Nimr, a Shi'ite cleric, which U.S. officials strongly believe was pushed by Prince bin Nayef, has led to a break in relations between Saudi Arabia and Iran and a wave of condemnation in the West. A war against the Iranian-backed Houthis in Yemen, pushed by bin Salman, had initial success but is now a stalemate that costs the kingdom $200 million per day. Last year’s decision to keep pumping oil in the face of declining prices, which both princes backed, has shrunk Saudi Arabia’s economic power and led to lower revenues and vast cuts in social services.

The rivalry is the result of an odd arrangement the royal family made after King Abdullah died in January 2015. The family's Allegiance Council anointed Salman king and bin Nayef crown prince.

There were multiple rationales for appointing bin Nayef, aside from his counterterrorism work. He is the son of the late Prince Nayef, who would have been in line for the throne if he hadn't died before Abdullah.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The new King Salman, however, then appointed his son, Mohammad bin Salman, deputy crown prince, placing him directly behind bin Nayef in the order of succession.

Which of the two princes will win in the end? Salman has a very high opinion of his son. “The king thinks the sun shines out of the boy's backside," said Simon Henderson, director of the Washington Institute's Gulf and Energy Policy Program. When Secretary Kerry meets with King Salman this weekend, he will also be meeting with young bin Salman.

The public applauded the young prince’s aggressive stance in Yemen. "To them, Saudi had never been so bold,” said a Saudi journalist who wished to remain anonymous.. “The Yemen operation had finally upped the ante for Saudis. Saudi Arabia didn't need any more nurse maids. He represented them, he was in touch with them.

The U.S. is less enthusiastic. Though he has compared himself to Winston Churchill and Margaret Thatcher, bin Salman is not as enamored with the West as his older rival.

Foreign intelligence services also question his decision-making. In December, the BND, Germany's intelligence agency, publicly released an extraordinary and scathing analysis of bin Salman, saying he is behind the kingdom's "impulsive policy of intervention." The minister of defense, the paper stated, “harbors a latent risk that in seeking to establish himself in the line of succession in his father’s lifetime, he may overreach.”

Bin Nayef is favored --it's hardly an exaggeration to say beloved -- by the United States. More than one U.S. official has privately said bin Nayef is the man the U.S. wants to be king.

When King Salman skipped last May's Camp David summit on Syria, seen as an affront to President Obama, he sent the two princes. Obama praised both but particularly noted bin Nayef's counterterrorism role.

"Mohammed bin Nayef has been a partner with us on counterterrorism work and security work for a very long time. So we have great admiration for him," said the President. "This is the first time that we had had a chance to work closely with the Deputy Crown Prince, and I think he struck us as extremely knowledgeable, very smart, I think wise beyond his years."

A senior U.S. intelligence official went even further, telling NBC News, “Crown Prince Muhammad bin Nayef is a strong and committed partner to the U.S., and he possesses an in-depth understanding on a range of security related issues. His pragmatic, proactive leadership in addressing complex security issues cannot be overstated.”

Here's one example cited by Riedel: When al-Qaida planted bombs on UPS and FedEx planes headed from Yemen to Chicago on the eve of the 2010 U.S. congressional elections, MBN called the White House and gave President Obama’s terrorism advisor -- now CIA Director --John Brennan the tracking numbers for the deadly containers. The planes were then detained at stopovers and the bombs removed.

It's not surprising. Bin Nayef has had an open line to the last four CIA directors, say U.S. officials. During the early post-9/11 years, bin Nayef would visit the U.S. four times a year to meet with his White House counterpart, Fran Fragos Thompson, sessions facilitated by bin Nayef's fluent English, learned in Oregon, where he attended Lewis and Clark College. Bin Nayef also studied at the FBI in the late 1980s, and at Scotland Yard’s antiterrorism institute between 1992 and 1994.

Another western diplomat told NBC News, "He is clearly very smart and ambitious but also focuses on what needs to be done and I would definitely describe him as a doer. One of the smartest things about him is that he has built up a team over the years that has a broad range of expertise and they are extremely loyal to him and if you look at the results successful.”

And he is no shrinking violet when dealing with the media. He will often leak tales of derring-do to the Saudi and other Middle Eastern media. No billboards, just a steady stream of positive stories with him as the hero.

The older generation of Saudi princes, who are closer in age to bin Nayef, also question why King Salman has invested so much power in his 29-year-old son, according to the Saudi journalist.

But whether the old guard’s regard for bin Nayef and American affection for him will help him become king remains to be seen.

Saudi Defence Minister and Deputy Crown Prince Mohammed bin Salman holds a press conference on Dec. 14, 2015, at King Salman airbase in Riyadh. According to media reports, Saudi Arabia announced the formation of a military coalition of 34 countries including Gulf states, Egypt and Turkey to fight "terrorism" in the Islamic world. but the alliance excludes regional rival Iran and several countries facing ongoing violence. Saudi Press Agency / via AFP - Getty Images

"The fact the U.S. officials like him can be as much as hindrance as a help and he's caught up in what is best described as a battle royale," said Henderson, who added that bin Nayef “feels threatened by Mohammed bin Salman and would like to sideline him."

Riedel thinks the U.S. may be making a mistake in pushing bin Nayef as hard as they have. He's no reformer, says Riedel, noting that for dissidents in the Middle East, bin Nayef is the "public face of repression in the kingdom," equating dissent with terror. Some of the "team" he has built up are informants.

Riedel and others in the U.S. government, believe bin Nayef, who still controls the counterterrorism apparatus, had to be part of the decision-making process that led to al-Nimr's execution. Another U.S. official said, "It's in his portfolio.”

How does it end? Not well is the experts' consensus. Bin Salman controls access to the royal court along with his mother. Thus, Riedel says, bin Nayef, as crown prince, cannot meet with the king without his deputy's permission.

Moreover, the king may not even be competent enough to control his succession, according to multiple sources. "Will the son connive with the favorite wife to deny Bin Nayef?” asks Reidel. "It happened in Jordan."

But bin Nayef is a survivor, literally. He's survived assassination attempts --at least three and possibly four -- the most serious in August 2009 when the brother of al Qaeda bombmaker Ibrahim al-Asiri blew himself up while shaking hands with him. Bin Nayef suffered minor burns.

"So he has luck,” said Henderson, “which is seen as a valuable asset in Saudi culture."

-- Andrea Mitchell contributed reporting to this story.