Rep. Michael McCaul of Texas almost did not become the next chairman of the Homeland Security Committee.

The three-way vote to decide the panel’s new boss was described by members as one of the closest they have ever seen, with the Republican Steering Committee voting as many as nine times before breaking the tie and deciding on McCaul.

“I’ve been here 22 years, and I’ve never seen anything like this before,” Speaker John A. Boehner, R-Ohio, said during the private meeting Tuesday afternoon, according to a source in the room.

Because sitting committee chairmen recuse themselves from voting on other committee chairmen, the steering committee had just 30 votes in the pool, including Boehner’s five votes and two controlled by Majority Leader Eric Cantor of Virginia.

As a result, the first three rounds of voting produced three-way ties, with McCaul, Rep. Mike D. Rogers of Alabama and Rep. Candice S. Miller of Michigan garnering 10 votes each. Finally, on the fourth try, Miller was eliminated.

“Everybody was in agony over it,” said a member of the steering committee, speaking on the condition of anonymity to discuss internal conference deliberations.

The members said that electing three women to conference leadership positions earlier this month alleviated some of the pressure to install a female committee head. Miller would have been the only Republican woman in such a position in the 113th Congress.

Nonetheless, the race between McCaul and Rogers, both of whom are more senior than Miller but joined the panel in the same year, was no easier. The steering committee voted three more times, each time coming up with a 15-to-15 tie. Finally, Boehner decided to take a break to move on to other business and to give members time to think about the decision and come back to the vote later.

But when they reconvened for another vote, the result was again a tie.

“It was just one of those things that was impossible to choose,” the member said.

Finally, on the ninth vote, at least one member switched sides, and McCaul emerged with a majority of the votes.

Several insiders described McCaul’s win as an upset. Heading into the vote, staffers and other members had described the choice as one between Rogers and Miller, with McCaul on the outside.

Still, McCaul said he secured the nod by emphasizing his background as a federal prosecutor for the Justice Department and as a chief of counterterrorism and national security for Texas’ branch of the U.S. attorney’s office.

“When the shoe drops, you want a guy who’s got to represent the conference on the TV or media who has experience, not only on Homeland, which I have had from day one, but that kind of prior experience,” he said.

His voice gruff from Texas cedar fever — a reaction to central Texas’ infamous pollen that he picked up when he spent the holiday at his family’s ranch in Blanco, between San Antonio and Austin — he said that Tuesday was probably not the best day to give the pivotal presentation to the Republican Steering Committee.

He said, however, that he made his case by emphasizing the four things he wants to focus on: terrorism, border security, cybersecurity and fixing the Homeland Security Department’s management structure.

In fact, McCaul is the sponsor of the DHS Accountability Act, which was debated on the floor Tuesday. It would create an independent panel to make recommendations about the Homeland Security Department’s capabilities. Shortly after the news about the chairmanship broke, McCaul was on the floor helping manage the bill.

He said he wants to move on the stalled cybersecurity bill and will start reaching out to Senate Homeland Security and Governmental Affairs Committee leaders. He said the two chambers have been very separate in the 112th Congress, and he hopes to bring them together around this issue.

“Cybersecurity is going to be the biggest area where you’re going to see legislation coming out of the committee,” he said. “We need to work together to get it done because, ultimately, every day that we can’t get anything done, we’re putting American lives at risk.”

McCaul added that he plans to put a lot of pressure on the department to secure the Southern border, including pushing a plan to redeploy surveillance technology used in Afghanistan to the border as the war winds down. He also said he wants to focus on the threat of al-Qaida and Hezbollah influence in the Western Hemisphere.