FBI Director Christopher Wray rebuffed requests from Republican lawmakers Thursday for information about a key agent accused of political bias against President Trump and the role the man played in exonerating Hillary Clinton of criminal wrongdoing and in starting surveillance of Trump campaign officials.

Mr. Wray’s refusal to comment on numerous matters involving Peter Strzok, the top FBI counterintelligence investigator in question, prompted Rep. Ron DeSantis, Florida Republican, to warn the director he was close to “walking into contempt of Congress.”

Making his first appearance before the House Judiciary Committee on Thursday, Mr. Wray found himself defending the bureau against accusations of political bias stemming from events that happened before he was sworn into office in August.

Mr. Strzok, who led the investigation into Mrs. Clinton’s email server in 2016, was removed from special counsel Robert Mueller’s team this summer after an internal probe found he sent messages to a colleague that showed possible bias for Mrs. Clinton and against Mr. Trump.

The Justice Department’s inspector general has been reviewing the FBI’s and the Justice Department’s handling of the Clinton probe, which cleared the former secretary of state of criminal wrongdoing. The messages were sent to another FBI lawyer, Lisa Page, who also temporarily worked on Mr. Mueller’s team, and were discovered in the course of that internal review.

Mr. Wray said he was limited in what he could say about Mr. Strzok because of the investigation, but he told lawmakers he would “take appropriate action if necessary” after the internal watchdog completes its review.

“I’m think it is important we not jump first and ask questions later,” he said.

But lawmakers pressed the FBI director, saying it was necessary to know the degree of Mr. Strzok’s involvement in other matters related to the ongoing investigation into Russian efforts to influence the presidential election last year and possible coordination with members of the Trump campaign.

“Did Peter Strzok help produce and present the application to the [Foreign Intelligence Surveillance Act] court to secure a warrant to spy on Americans associated with the Trump campaign?” asked Rep. Jim Jordan, Ohio Republican.

“I’m not prepared to discuss anything about the FISA process,” Mr. Wray said.

Earlier in the day, Mr. Jordan called for a second special counsel to be appointed to examine how a FISA warrant was obtained to spy on members of Mr. Trump’s campaign team.

Mr. DeSantis followed up on the point, arguing that if Mr. Strzok was involved, then that information needed to be disclosed to Congress.

“If they were getting this information from a political party and using it for surveillance against an opposition party candidate, that’s a problem,” he said. “Do you agree that would be a problem for the American people?”

“I do agree that any improper use of the FISA process for political purposes is something we should all be very concerned about,” Mr. Wray said.

In the meantime, Mr. Wray said, he has emphasized that the FBI’s decisions “need to be made based on nothing other than facts and the law … not any political considerations on either side of the aisle.”

Mr. Strzok also reportedly played a role in changing the language that FBI Director James B. Comey used about Mrs. Clinton, exonerating her from criminal liability related to her mishandling of classified information on a private email server. The draft language was reportedly changed from “grossly negligent” to “extremely careless.”

Asked by committee Chairman Bob Goodlatte, Virginia Republican, whether the language might have been changed to ensure Mrs. Clinton was not criminally charged, Mr. Wray said he couldn’t comment because it was all part of the inspector general’s probe.

“I leave it to others to conclude whether ‘extremely careless’ and ‘gross negligence’ are the same thing,” he said.

Throughout the hearing, lawmakers made clear that they were concerned about the FBI’s integrity and asked Mr. Wray to respond to criticism Mr. Trump lobbed at the bureau over the weekend — saying its reputation was “in tatters.”

“There is no shortage of opinions out there,” said Mr. Wray, not mentioning the president by name. “What I can tell you is the FBI that I see is tens of thousands of agents and analysts and staff working their tails off to keep Americans safe from the next terrorist attack, gang violence, child predators, spies from Russia, China, North Korea and Iran.”

White House press secretary Sarah Huckabee Sanders said Thursday that there is no discrepancy between the president’s criticism of the FBI this week and Mr. Wray’s defense of the agency.

“The president’s issues are with the political leaders in the FBI under former director Comey,” she said.

Asked how Mr. Trump’s comments affected the FBI, Mr. Wray said employees are used to receiving criticism.

“The agents of the FBI are big boys and girls. We understand we will take criticism from all corners, and we are accustomed to that,” he said. “My experience has been that our reputation is quite good.”

Mr. Goodlatte said “even the appearance of impropriety” could harm the FBI’s reputation and mission.

“We cannot afford for the FBI — which has traditionally been dubbed the ‘premier law enforcement agency in the world’ — to become tainted by politicization or the perception of a lack of evenhandedness,” Mr. Goodlatte said.

The ranking Democrat on the committee, Rep. Jerrold Nadler of New York, said the president’s outbursts are “cheapening and coarsening” the dialogue surrounding the issues facing the Justice Department and the FBI. He said the FBI director should more forcefully speak out against attacks on the bureau’s reputation.

“Your job requires you to have the courage to stand up to the president,” Mr. Nadler said. “There are real consequences for allowing the president to continue unchecked in this manner.”

Lawmakers also pressed Mr. Wray multiple times to weigh in on whether the president could be charged with obstruction of justice.

Mr. Wray demurred, saying it was a legal question better suited for lawyers to handle.