WASHINGTON — As President-elect Donald Trump continues his search for a secretary of state — a conspicuously public effort, in which the fortunes of the candidates rise and fall like characters in a political potboiler — allies of one of those candidates, David Petraeus, are mounting a vigorous lobbying campaign on his behalf.

Two influential Republican national security figures — Sens. John McCain of Arizona and Lindsey Graham of South Carolina — spoke out publicly in favor of Petraeus this week, declaring that he was well qualified and saying his confirmation would not be hindered by his having pleaded guilty to mishandling classified material and being forced to resign as CIA director.

"He's one of the most talented and capable leaders I have ever known," McCain, chairman of the Senate Armed Services Committee, said in one of the most animated exchanges he has had with reporters since he was re-elected last month.

As for the scandal involving the leaking of classified material — in which Petraeus resigned after the disclosure that he had given a confidential diary to his biographer and mistress, Paula Broadwell — McCain said, "I think people make mistakes in life and you move on."

Among the major questions is whether Petraeus would be able to regain his security clearance; experts say Trump would be able to override any objections to that through his executive privilege.

Petraeus has long captured Trump's imagination, but he comes with the baggage from not only his own scandal but also from having been CIA director during the attack on the diplomatic outpost in Benghazi, Libya.

Graham, who also serves on the Armed Services Committee, said Petraeus would be "an extraordinary pick." He described him as "one of the most uniquely qualified" of the people on Trump's list, noting that he was the best known of all of them overseas, after his CIA stint and his military career, in which he was the top commander in Iraq and Afghanistan.

Some Democrats signaled that they would keep an open mind. Sen. Dianne Feinstein of California, who will be the ranking minority member of the Judiciary Committee, said she had "great respect for his mind." She described his mishandling of classified material as "the one question that comes up" but did not suggest that it would prevent his confirmation.

But Democrats would be likely to use a Petraeus nomination as a way to portray Trump as a hypocrite. He hammered Hillary Clinton throughout the campaign for her use of a personal email address and computer server, saying that she should be jailed, even after the FBI director, James B. Comey, said her misconduct had been less serious than that of Petraeus.

Democrats are also likely to object to the prevalence of retired generals in jobs that normally go to civilians, particularly if Trump also names Gen. James N. Mattis as defense secretary — a prospect that some close to the Trump transition said appeared to be receding in recent days.

Trump met with Petraeus on Monday, declaring on Twitter afterward that he had been "very impressed!" A person close to the transition said Petraeus was also being considered for the post of director of national intelligence — a logical choice, given his tenure at the CIA, but one that lacks the glamour and profile of secretary of state.

During their meeting, a person briefed on the conversation said, Petraeus spoke with Trump about his guilty plea, to a misdemeanor, for mishandling classified material and how it might affect his odds of getting confirmed.

The contest for secretary of state has become the most protracted and closely watched of Trump's transition, and he shows no sign of being rushed into a decision.

People briefed on the transition say the president-elect is now considering three candidates in addition to Petraeus: Mitt Romney, the former Republican presidential nominee; Rudy Giuliani, the former mayor of New York City; and Sen. Bob Corker, the Tennessee Republican who is chairman of the Foreign Relations Committee.

Gen. John F. Kelly, a retired Marine general, has also been in the mix and met again with Trump on Wednesday, although in recent days his name has been mentioned more for secretary of homeland security.

On Tuesday evening, Trump had a very public dinner with Romney at Jean-Georges in Manhattan, the second time they met since the election. But deal was far from sealed. Aides to Trump said Wednesday that their boss would take his time making the choice.

Some of Trump's closest aides — including Kellyanne Conway, who managed his campaign — have argued vehemently against naming Romney, saying his repeated denunciations of Trump during the campaign ought to rule him out.

Giuliani, a fierce loyalist of Trump's, emerged as the early favorite for secretary of state. He has made no secret of his desire for the job. But his extensive record of business dealings with foreign governments could cause him trouble in a confirmation hearing. In recent days, people involved in the process said, his prospects have dimmed.