A heat-seeking plane flew overhead as tactical teams on the ground tightened their perimeter around the suspected whereabouts of Danelo Cavalcante, a convicted killer who came to the U.S. illegally while suspected of another murder in his home country of Brazil.

The plane, piloted by the U.S. Drug Enforcement Agency to assist Pennsylvania State Police and Border Patrol agents on the ground, picked up a heat trail with its FLIR imaging technology around midnight, according to Lt. Col. George Bivens.

It's a scenario the DEA has drilled for decades with drug smugglers in mind.

CONVICTED KILLER DANELO CAVALCANTE CAPTURED IN PENNSYLVANIA NEARLY 2 WEEKS AFTER PRISON ESCAPE

Danelo Cavalcante is escorted out of the Pennsylvania Police Headquarters

Danelo Cavalcante is escorted from Pennsylvania State Police Headquarters in Avondale, Pa., Wednesday, Sept. 13. Cavalcante, a convicted killer, escaped from the Chester County Prison Aug. 31, sparking a massive, two-week manhunt. (Kevin C. Downs for Fox News Digital )

But lightning storms blew in, forcing the plane to depart after first pinging the suspect's location, Bivens said.

So, police and Border Patrol agents set up their perimeter, keeping their unwitting prey penned in until the weather cleared.

"Tactical teams made a decision to secure that area, that smaller area, as best they could and hold it through the storm until we could bring additional resources in and bring aircraft back overhead to ensure that we did not have an issue with an escape," Bivens explained. 

A photo of Danelo Cavalcante's arrest

Photos provided by the Pennsylvania State Police show the apprehension of escaped prisoner Danelo Cavalcante in South Coventry Township, Pa., Wednesday, Sept. 13.  (Handout from Pennsylvania State Police)

Around 8 a.m. Wednesday, the manhunt came to a close as officers encircled Cavalcante in brush.

"They were able to move in very quietly," Bivens said. "They had the element of surprise. Cavalcante did not realize he was surrounded."

He tried to crawl away when he realized they were right on top of him, Bivens said. 

ESCAPED KILLER SHOT AT BY PENNSYLVANIA HOMEOWNER WHILE ON THE RUN, POLICE SAY

So law enforcement released two K-9s — one from Customs and Border Protection's elite BORTAC unit, another from the Special Emergency Response Team of the Pennsylvania State Police.

PSP k9 Loki wearing goggles and chain collar

Pennsylvania State Police said a K-9 named Loki suffered heat-related illness during the two-week manhunt. They did not identify which police dogs were involved in Cavalcante's capture. (Pennsylvania State Police)

The K-9 involvement came a week after Loki, a state police dog, was rushed to a veterinarian for heat-related illness during the grueling manhunt.

Bivens declined to identify the dogs who assisted in the operation that led to Cavalcante's capture Wednesday morning.

Danelo Cavalcante

Howard Holland, acting warden of Chester County Prison, released video of Cavalcante's escape from the prison, which shows the convicted killer crab walking up a wall. (Chester County DA)

BORTAC agents are members of an elite Border Patrol unit based in El Paso skilled at apprehension. They played a critical role in the capture of the escaped inmates in the Dannemora prison break in New York in 2015 and bringing the mass shooter in Cleveland, Texas, into custody earlier this year.

One of the dogs bit Cavalcante so hard on the head, aerial video showing police emerge from the forest with him in handcuffs showed a stream of blood down his face.

Cavalcante's injuries were not serious, Bivens said, and no officers were hurt.

PENNSYLVANIA KILLER DANELO CAVALCANTE'S SISTER ARRESTED BY ICE; ESCAPEE TRIED TO CONTACT FORMER CO-WORKERS

Cavalcante had nothing on him but the clothes on his back and a stolen rifle.

Police announced the arrest about an hour later at a nationally broadcast news conference. 

Danelo Souza Cavalcante on trail cam

Cavalcante was spotted on a trail cam on the night of Sept. 4 at Longwood Gardens in Kennett Square as he squeezed his way through a wooded area to evade capture. (Pennsylvania State Police)

Over the past two weeks, police received numerous reports of possible sightings and images showing Cavalcante slinking around in the dark. Those images showed he'd shaved his beard and changed his clothes. Police eventually cornered him in the area of Coventryville Road, home to several farms, a kennel and a school.

Investigators do not believe Cavalcante received any outside help. 

After his arrest, he reportedly told authorities that search teams had nearly stepped on him. He stole fruit from a watermelon patch, drank stream water and buried his own human waste to conceal his trail, according to Philadelphia's WPVI-TV

By around 2 p.m. Wednesday, after being treated at a hospital, Cavalcante arrived at a jail in Avondale, Pennsylvania, barefoot, handcuffed and wearing a hospital gown. He will be transferred to a state prison to serve out a life sentence for the 2021 murder of his ex-girlfriend, Deborah Brandao.

Deborah Brandao smiles in close up

Victim Deborah Brandao, who Danelo Cavalcante killed in 2021. (Chester County District Attorney's Office via FOX 29 Philadelphia)

He is also suspected of killing a man in Brazil in 2017. According to PBS News, Brandao's discovery of his potential involvement in that case led to her murder.

The manhunt that ended Wednesday is not the first Cavalcante has been involved in. After killing Brandao, he hit the road and was captured by police in Virginia, according to FOX 29 Philadelphia

His escape put the community on edge, especially after he began breaking into area homes to steal supplies. He stole food and clothes and changed his appearance.

WATCH: Pennsylvania authorities release video of Danelo Cavalcante's escape from prison

In one incident, he stole a gun and allegedly exchanged fire with a homeowner before fleeing back into the woods. 

Authorities shut down local schools and urged residents to lock their doors and stay inside.

One former resident told Fox News Digital she was happy circumstances had forced her and her husband to move away last year.

"Thank you God for pushing us out, moving us down South, and we're not there anymore," she said. "Thank God the patriots that do live there, they are locked and loaded, and they’ve got guns."

Helicopters overhead broadcast an audio recording of Cavalcante's mother pleading for him to surrender.

CLICK TO GET THE FOX NEWS APP

"No escaping the infrared," said David Katz, the CEO of Global Security Group and a longtime DEA agent whose tactical team practiced FLIR drills in the 1990s.

Fox News' Griff Jenkins contributed to this report.