A Kazakhstan-born Brooklyn man who the feds say moved to Syria six years ago to join ISIS — rising to become one of the terror group’s top snipers — was ordered held without bail Friday as it emerged that a trove of threatening and boasting text messages was his undoing.

“You will be f–king scared for the rest of your life,” accused jihadist Ruslan Maratovich Asainov, 42, seethed in a text message sent to an unidentified recipient in January 2015, a year into his move to Syria, according to court papers.

“We will get you. We will f–king kill you,” the text ranted. “You heard of ISIS. We will get you. You need to obey. You need to be punished you f–king (redacted). We will find you and teach you how to behave.”

Asainov, who was flown back in custody by the FBI on Thursday, has been charged with providing material assistance to a terror group and attempting to provide such assistance. The charges carry a potential 20-year maximum sentence.

Federal prosecutors say Asainov was born in Kazakhstan but subsequently became a naturalized US citizen, living in Brooklyn from 1998 to 2013.

In December of 2013, he left Brooklyn — where former neighbors in Bensonhurst said he’d lived with his then-wife and young daughter — taking a Christmas Eve red-eye flight to Istanbul.

“They were a nice married couple,” former neighbor Albina Veribrus, 57, told The Post of Asainov and his wife, Alexandra.

“She got pregnant, I was very happy for her. They had a baby girl. She was adorable,” the neighbor said.

“She was very nice, a typical American girl,” the neighbor said of Asainov’s wife.

“She worked in retail. He was polite, but aloof. At first he was normal, but then he grew a beard. She said they were arguing before, he was drinking, then she said he stopped and everything was good between them.”

Another former neighbor said the wife moved separately to England.

In Syria, Asainov trained to be a top-notch ISIS sniper and firearms instructor, prosecutors say. Along the way, he sent back a stream of incriminating messages and photos, including from battlefields.

“The defendant is an ISIS warrior who served as a top sniper for the organization and as a trainer,” Assistant US Attorney Saritha Komatireddy told Magistrate Judge Steven Gold.

“Even grandmothers are coming,” to join ISIS, Asainov, described in court papers as a prolific texter, messaged a would-be terror recruit in August 2014.

The would-be recruit was actually an NYPD confidential informant.

In March, 2015, Asainov messaged the same informant asking for $2,800, which he hoped to use to buy a rifle scope, court papers say.

The informant did not send the money. Still, a month later Asainov sent back a battlefield selfie. In it, he wears combat fatigues and holds a rifle with a scope.

Asked by the judge on Friday whether he spoke English, understood his rights, and needed a court-appointed attorney, Asainov repeatedly nodded “Yes,” and each time had to be reminded by the judge to speak his answer out loud so it could be recorded.

After court, defense lawyer Susan Kellman explained that her client did not want to answer to the judge.

“He answers to a higher authority,” she said. “He says his ruler is Allah.”

She also called him “very pleasant, very forthcoming” and said she had no trouble understanding his speech.

“His English is perfect,” she said. “He lived in Brooklyn. He’s a Brooklyn boy.”

Additional reporting by Laura Italiano