WASHINGTON — As President-elect Donald J. 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 H. Petraeus, are mounting a vigorous lobbying campaign on his behalf.

Two influential Republican national security figures — Senators John McCain of Arizona and Lindsey Graham of South Carolina — spoke out publicly in favor of Mr. 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 director of the C.I.A.

“He’s one of the most talented and capable leaders I have ever known,” Mr. McCain, who is 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 Mr. Petraeus resigned after the disclosure that he had given a confidential diary to his biographer and mistress, Paula Broadwell — Mr. McCain said, “I think people make mistakes in life and you move on.”