ISTANBUL -- In the wake of an otherwise bitter defeat, Turkey's opposition parties found a silver lining: They had denied President Recep Tayyip Erdogan the thumping victory he craved in Sunday's referendum on expanding his powers.

With nearly half of the country opposing the constitutional changes -- 51 percent voted in favor -- it seemed to provide a rare opening for Turkey's perennially weak opposition to challenge ­Erdogan and his Justice and Development Party, or AKP, a finely tuned, election-winning machine.

There was a problem, though: There may be no one to lead such a challenge.

Key opposition leaders are viewed as too soft to confront Turkey's hard-nosed leader or too narrow in their politics to gain broadappeal. And two of the country's most dynamic opposition figures, both from the pro-Kurdish Peoples' Democratic Party, were thrown into jail by the government last year.

In the referendum, voters were asked to choose "yes" or "no" on a set of constitutional changes that would change Turkey's system of government from parliamentary to presidential, a transformation that would give Erdogan vast new authority. The "yes" side won by more than 1 million votes.

Mahmut Ekinci, a retired lawyer who in past elections had voted for Turkey's main opposition party, the Republican People's Party, or CHP, said he voted for Erdogan's side because it endowed Turkey with a "strong" leader.

The questions about the strength and ability of the opposition are especially urgent at a time when public debate about the ­razor-thin victory margin is raging, as are allegations by opposition parties and international observers that the vote was marred by ballot irregularities and other violations.

Erdogan's opponents have a brief period in which to demonstrate their resolve to the electorate before he consolidates his hold on the levers of state, including the judiciary, and indelibly shapes the narrative of his referendum victory, analysts said.

The window may already be closing. On Wednesday, in a major setback for several opposition parties, the election board rejected their petitions to annul the results of the referendum over the panel's decision to accept ballots lacking an official seal.

Also Wednesday, authorities detained dozens of people who had joined in protests that followed the referendum.

Erdogan and senior government officials say the vote is a settled matter. The public had spoken clearly, they say, no matter how narrow the margin of victory, and it was time to move on.

"It doesn't matter if you win 1-0 or 5-0," Erdogan, a former semiprofessional soccer player, told CNN on Tuesday. "The ultimate goal is to win the game."

Meanwhile, Erdogan's government received an important boost from the Trump administration after the vote. On Monday, President Trump called Erdogan and congratulated him on the referendum win. And Wednesday, Turkish and U.S. officials said Trump and Erdogan would meet before the NATO summit in Brussels next month.

Some of the doubts about the Turkish opposition have focused on Kilicdaroglu, the courtly, soft-spoken head of the CHP. With his staid manner and background as a former bureaucrat, he was widely seen as no match for the sharp-tongued Erdogan, a savvy populist and tireless campaigner.

Even so, many supporters have credited Kilicdaroglu for the strategy that ensured the close result: making sure the CHP kept as low a profile as possible, to deny its critics a target for attacks.

The strategy was "smart" and acknowledged the party's disadvantages, said Asli Aydintasbas, an Istanbul-based fellow at the European Council on Foreign Relations. At the same time, she said, "it doesn't say great things about a political party that they have to keep a low profile."

There were other missteps by the CHP, she said, including its failure to comprehensively monitor polling stations in some parts of the country, its frequently ad hoc ground strategy during the campaign and a botched statement by Kilicdaroglu about a failed coup last summer that may have cost his side votes.

And in the last two weeks of the campaign, Erdogan upended the CHP strategy by focusing on Kilicdaroglu -- framing every criticism of the proposed changes as a spurious accusation by a feckless opposition leader, while criticizing Kilicdaroglu's past performance in government, leading the national social security agency.

"The subtext was, I may be an autocrat, but this guy is completely incompetent," Aydintasbas said.

Enis Berberoglu, a CHP lawmaker from Istanbul, called Erdogan's focus on Kilicdaroglu "cheap" and said it had demonized the opposition leader -- just one example of an unfair campaign in which the president and his allies also had associated their opponents with terrorists, he said.

Going forward, the CHP would focus on "making clear what happened during the election," ­Berberoglu said. The public would be watching "what we do in the courts, on the streets, in meetings," he said.

Murat Yetkin, a political analyst and editor of the daily Hurriyet News, said the CHP leadership seemed to be doing everything it could on the legal front to force an investigation of the alleged voting irregularities, while also preventing a risky confrontation with pro-government forces by keeping its supporters from demonstrating in large numbers.

But perceptions will be hard to change. Days after the referendum, Kilicdaroglu had become a sensation on the Internet -- but not in the way he might have hoped. On social media, Turks passed around memes depicting the CHP leader as reacting mutedly to alarming things surrounding him, including Darth Vader and the creature from the film "Alien" seen on-screen bursting through someone's chest.