Washington(CNN) Emails obtained by CNN show the FBI agent at the center of a Capitol Hill storm played a key role in a controversial FBI decision that upended Hillary Clinton's campaign just days before the 2016 election: the letter to Congress by then-FBI Director James Comey announcing the bureau was investigating newly discovered Clinton emails.

The new revelation about FBI agent Peter Strzok comes as Republicans accuse him of being sympathetic to Clinton while seeking to undermine Donald Trump during the heat of the 2016 campaign season.

Strzok, who co-wrote what appears to be the first draft that formed the basis of the letter Comey sent to Congress, also supported reopening the Clinton investigation once the emails were discovered on disgraced former Rep. Anthony Weiner's laptop, according to a source familiar with Strzok's thinking. The day after Strzok sent his draft to his colleagues, Comey released the letter to Congress, reigniting the email controversy in the final days of the campaign.

Strzok did, however, harbor reservations about Comey making a public announcement just days before the election and sent a text message to that effect, two sources said. And Strzok's text messages provided to Congress show him grappling with the fallout of making the letter public, according to a CNN review of his texts.

This new information reveals a more complicated portrait of Strzok than many of his critics have painted in public. Republicans have seized on text messages between Strzok and FBI lawyer Lisa Page, who were often critical of Trump, to characterize the two -- who were having an extramarital affair -- as part of an effort to go easy on Clinton and get tough with Trump.

And conservative critics have seized on their texts to make the case that special counsel Robert Mueller's investigation into the Trump campaign is tainted with bias since the two officials were briefly on Mueller's team -- with Trump himself accusing Strzok of "treason" in a Wall Street Journal interview.

While Strzok was removed from the Mueller probe last year, he also was deeply involved in the Clinton investigation and sought to pursue it "aggressively," according to the source familiar with Strzok's thinking.

In an October 27, 2016, email the FBI provided to congressional investigators, Strzok informs his colleagues he and another FBI agent had drafted "the first cut" of the letter notifying Congress of the decision to reopen the Clinton email investigation. His colleagues then exchanged two additional emails referencing further comments and changes to Strzok's initial draft, which was ultimately forwarded to Comey by then-FBI chief of staff James Rybicki.

One of the drafts, reviewed by CNN, was recently produced to Congress with the email chain. But it is unclear whether that draft was the initial copy written by Strzok or one incorporating others' edits. That draft states that the FBI had an "obligation to take appropriate investigative steps to review" the newly discovered emails on Weiner's laptop.

The next day, on October, 28, 2016, Comey sent the final letter to Congress, editing out the line that he had an "obligation" to take steps to review. Instead, new language was added saying that Comey had been briefed by his team "yesterday" and that he "agreed that the FBI should take appropriate investigative steps."

The key line noting that the "FBI has learned of the existence of emails that appear to be pertinent to the investigation" appears in both the final version and the earlier draft reviewed by CNN.

Two sources who reviewed the text messages between Strzok and Page said they exchanged messages on November 6, when Page said she didn't know if they should issue a public statement, which Strzok agreed with. The two did not describe which statement they were referring to, but that same day, Comey sent another public letter to Congress to close the Clinton email investigation -- just two days before the election.

Stzrok's attorney declined to comment on the draft statements and related text messages.

Comey's announcement sent the Clinton campaign into full damage control and gave Trump major ammunition, something many Democrats now say cost Clinton the presidency.

"Our analysis is that Comey's letter raising doubts that were groundless, baseless, proven to be, stopped our momentum," Clinton said days after the election.

Strzok led the investigation of Clinton's email server as the No. 2 official in the FBI's counterintelligence division, and then was a member of the FBI's team investigating possible coordination between Trump's team and Russian officials.

Strzok edited Comey's July 2016 statement on the Clinton investigation that cleared her, changing the language describing Clinton's actions as "grossly negligent" to "extremely careless."

But Strzok was removed from Mueller's team over the summer after the Justice Department's inspector general discovered anti-Trump text messages between Strzok and Page, who was assigned to the Mueller investigation in the summer but returned to the FBI before Mueller was notified of the texts.

The texts between Strzok and Page have been of major interest to congressional Republicans, some of whom charge that Strzok's texts show that Mueller's investigation is biased against Trump.

Republicans have pointed to the messages to raise questions about the FBI's investigations into Clinton and Trump, both of which are being scrutinized by multiple congressional committees.

In one February 2016 text released last week by Senate Judiciary Committee Chairman Chuck Grassley, Page and Strzok appear to discuss the possibility of tamping down their actions because Clinton could become the next president.

"She might be our next president. The last thing you need us going in there loaded for bear," Page said in a discussion on February 25, 2016, about personnel involved in the investigation.

"Agreed," replied Strzok.

Two tranches of the text messages have already been provided to Congress. Five months of texts in the time leading up to the launch of Mueller's investigation were initially missing due to what Justice Department officials said was a technical issue, but they have since been recovered. Attorney General Jeff Sessions said that outside of the five-month span, more than 50,000 messages have been reviewed by the inspector general's office.