Updated

The alleged gunman who fatally "ambushed" an Indiana police officer on Wednesday will be charged with murder, according to court documents obtained by Fox News.

Shane Meehan, 44 of Terre Haute, will face a premeditated murder of a federal agent charge in connection with the death of Terre Haute Det. Greg Ferency. Ferency, a 30-year veteran of the police force and a father of two adult children, was fatally shot outside the FBI Indianapolis Resident Agency around 2:15 p.m., authorities said. 

He had been assigned to an FBI task force since 2010, officials said. 

"Greg was not only a long-standing member of the police department of Terre Haute," Paul Keenan, the FBI Indianapolis special agent in charge, said during a news conference Thursday. "He was a valued member of our FBI family."

Detective Greg Ferency was a 30-year veteran of the Terre Haute Police Department.

Detective Greg Ferency was a 30-year veteran of the Terre Haute Police Department. (Terre Haute Police Department )

Federal prosecutors said Meehan pulled up to the gate of the FBI Indianapolis Resident Agency building and threw a Molotov cocktail. When Ferency walked out, Meehan allegedly shot him. Ferency, who returned fire, was taken to a hospital where he later died. 

During the chaos, Meehan "engaged in a gun battle" with an FBI agent who also responded. 

"An agent inside our office heard the gunshots, came outside and engaged the suspect and fired at him," Keenan said.

Meehan was struck twice, but investigators were unclear if the bullets came from Ferency or an FBI agent, court documents said. He drove himself to a hospital and underwent surgery for his gunshot wounds. 

"An attack on law enforcement is an attack on us all, said John Childress, acting U.S. attorney for the Southern District of Indiana. "As citizens of this county, we enjoy on a daily basis the security and protection provided by the men and women of law enforcement. That security and protection is all the more precious because it is at times paid for with the lives of those who have chosen to protect us. 

CLICK HERE TO GET THE FOX NEWS APP

The FBI, which is leading the investigation, executed several search warrants Thursday, including at Meehan's home and vehicle where several items were seized, including three Molotov cocktails, firearms and ammunition. 

Investigators are still searching for a motive. 

Terre Haute Police Chief Shawn Keen said Ferency was his neighbor before he became a police officer. 

"You will not meet a finer person," he said. "There’s not anything he did that he didn’t put 110% into. He was an amazing person."

Mayor Duke Bennett said Ferency's death is the third for a police officer in the line of duty since his time in office. Two other officers were killed in 2011 and 2018. 

Meehan faces up to life in prison.