The fledgling government of Libya has hired a top-flight Washington PR firm to represent its interests in D.C., even though by all accounts Libya is a failed state with no real functioning government.

This month, the Libyan embassy in Washington, which maintains a small office in the Watergate office complex, signed a one-year contract worth $1 million with Qorvis MSLGROUP, to “provide strategic advice and assistance on public relations issues,” according to records filed with the Justice Department.

Precisely why the government has decided to spend so heavily on a foreign political campaign when it’s fighting for its life against Islamic radicals, political rivals, and ISIS is unclear. Officials at the embassy didn’t respond to emails and phone calls seeking comment.

But Libya needs all the help it can get in Washington, which officially recognizes a democratically-elected government in the eastern city of Tobruk, and not a rival faction in Tripoli. The country’s embassy in the U.S. is operated by Tobruk. Libya has become a breeding ground for jihadists, and ISIS has staged mass beheadings of Christians and journalists. The overwhelming number of emigrants fleeing North Africa across the Mediterranean for Europe are leaving from Libya. And Egypt, which has managed to repair some of its relations with the Obama administration after a 2013 military coup that led to a halt in U.S. arms sales, sees Libya as a major threat to its internal security, both because Libya has become a hotbed for radicals and is the source of a huge illicit arms market.

Libya is by no means a powerful force in the Middle East and North Africa. Nor is the Tobruk administration skilled at navigating the waters of U.S. politics and foreign policy, according to regional officials and experts on the region, who said the embassy in Washington is staffed largely by activists, not diplomats.

“The government in Tobruk is fighting for its very existence,” Jonathan Schanzer, the vice president for research at the Foundation for Defense of Democracies, a Washington think tank, told The Daily Beast. “Tripoli, the former capital of Libya, is now in the hands of their enemies. Public relations will not win this battle, but it will undoubtedly be an important component of the overall effort to maintain international support and recognition.”

Given that Libya barely has a government to speak of, and presumably not much of a treasury, it’s unlikely that the administration in Tobruk is paying Qorvis’s hefty fee, said several individuals who follow Libya’s internal politics and the Washington lobbying efforts of other countries in the Middle East and North Africa. More likely, a government with deep pockets that has supported Tobruk in its struggle to control the country is bankrolling the Washington campaign, they said.

There’s precedent for a third party paying for a country’s PR efforts. In 2013, the government of Egypt hired Glover Park Group to help repair its relationship with the U.S. after the coup, which ousted a democratically elected administration. A source familiar with the contract, who spoke on condition of anonymity, said it was unusually controversial within the company and divided employees over whether they should be doing business with a junta that also was suppressing journalists and free speech. (Glover Park declined to comment for this article.)

The deal drew so much negative attention, in the U.S. and in Egypt--where citizens bristled at Glover Park’s extravagant $250,000-a-month fee--that the Egyptian government issued a public statement emphasizing that a third party was paying the PR bill.

The government didn’t identify who that generous patron was, and the official contract between Glover Park and Egypt that was filed with the Justice Department states that Egypt is paying the company’s tab.

So it may be impossible to know for sure from official filings if another source is behind Libya’s contract with Qorvis, which states that the Embassy of Libya is paying for services that include “political advice and counsel,” “political insights,” “communications with the administration,” and “regular briefings on Capitol Hill.” Qorvis also promises to provide “message development” and “rapid response” in the media for Libya.

While Libya is just beginning its PR strategy, a true regional powerhouse, Saudi Arabia, is taking its years-old message campaign to the new terrain of social media.

Lobbying Washington heavies is old hat for the House of Saud, but its push into social media metrics and analysis comes as ISIS militants have proved adept at using Twitter, Facebook, and YouTube to attract adherents and fighters—the very ones the Saudis are helping the U.S. bomb in Syria. The kingdom also has been locked in mortal combat with Islamic radicals within its own borders, where, the government announced Tuesday, it had arrested 93 people suspected of plotting attacks, including on the U.S. embassy in Riyadh.

In March, the Saudi embassy in Washington hired Targeted Victory, a Virginia company that handled digital communications for Mitt Romney’s 2012 presidential campaign, to provide “digital consulting services,” “social media content and management,” and “strategic advice and digital consulting services for the promotion of and education on Saudi Arabia.”

Targeted Victory declined to answer questions about what kind of social-media magic the firm is working for Riyadh, as did Qorvis, to which Targeted Victory is a subcontractor.

But the head of Zignal Labs, which is doing the social data-crunching for Targeted Victory, told The Daily Beast that his company provides “analytics and measurements” for its clients. “Zignal Labs has many customers throughout the world across many different industries who use our platform to monitor the media ecosystem and direct their communications initiatives,” said Josh Ginsberg, the company’s CEO.

Zignal monitors social media to keep track of what’s trending, and when negative stories are crowding out other chatter. For instance, when news broke that Democratic presidential front-runner Hillary Clinton had used a private email account and server while she was secretary of state, Zignal showed how tweets about the scandal were eclipsing mentions of Clinton’s Republican rivals—and presumably her own then-undeclared presidential campaign.

Zignal feeds that kind of real-time tracking to its clients so they can “maintain awareness of the dynamic media environment” and “pinpoint which stories are accelerating so that you stay ahead of breaking news,” according to the company’s website. That makes Zignal a potentially powerful tool for crafting a political message, and doing damage control.

That’s something the Saudis have been doing a lot of lately—at least of the figurative variety. Riyadh has come under pressure from Washington to pull back on its airstrikes against Houthi militants in Yemen, where civilian casualties have skyrocketed. Desperate to stanch the collateral damage, U.S. intelligence agencies have provided more information to the Saudi air forces to help them better target Houthi positions and avoid hitting civilian buildings.

In hiring Targeted Victory, the Saudi embassy has brought on a team of social-media mavens that are becoming darlings of the GOP establishment. The company has said that its clients include presidential candidate Senator Marco Rubio’s political action committee Reclaim America, as well as the Republican National Committee, super PAC American Crossroads, and the Republican Jewish Coalition. For its Saudi work, the company will be paid $40,000 a month, according to records filed with the Justice Department.