He was a married physical therapist with a practice in Manhattan — and a deep hatred for his ex-wife.

After years of battling his former spouse over custody of their 6-year-old son, James Shields finally snapped Monday night, fatally shooting his ex, their son, his current wife and then himself in the living room of hisAstoria home.

It was ex-wife Linda Olthof’s birthday, authorities said.

“I had the perfect life a few years ago but it has spiraled out of control,’’ the distraught 38-year-old dad wrote in April on GoFundMe, where he set up a page titled “Child Kidnapping’’ — and begged for $30,000 in contributions to help fund his legal fight, though he apparently had no takers.

Shields lamented that the battle royale with his director ex, 47, had recently begun taking a heavy toll on his second marriage to wife Saskia, 37.

“This is very embarrassing for me to be writing in this public forum, but my back is against the wall and I have no where else to turn,” he wrote on the crowdfunding Web site. “How do I choose between financially ruining my current relationship vs giving up the battle for my son?’’

On Monday night, Shields decided not to choose at all. He simply killed everyone involved, including himself.

He went on his slaughterous spree after spending the week with his son, according to Queens DA Richard Brown, as the boy and his mom prepared to leave the home at 23-07 30th Drive.

Shields, armed with two legally registered Glock handguns — a G17 and G19 — pumped a single bullet into each of his victims, cops said. One of the women was shot in the face and the other in the head.

Shields shot himself in the chin, leaving behind so much “gruesome settling of the blood” that it at first appeared to detectives as though he’d slit his throat, according to NYPD Chief of Detectives Dermot Shea on Tuesday.

“The deceased were all in close proximity to each other,’’ Shea said, with Shields nearest to the door — with an additional 70 rounds of ammo on him.

“What those rounds were meant for will never be known,’’ Shea said.

The bodies of Shields and his victims were discovered around 9 p.m. Sunday — when the woman who takes out the trash for the building spotted them through the apartment’s rear window, police sources said.

The woman told The Post by phone that she was “too traumatized” to speak.

“I already spoke to detectives,” she said in Spanish. “I told them step by step what happened, and I can’t do it again.”

The horrific crime was the culmination of years of a no-holds-barred personal war between Shields and Olthof that began even before their son was born.

Olthof and Shields met when he “lived close to where she always stayed” in the city, and they were just friends for years, said her pal, Katarina Justic.

“[She] called him a real New York guy,’’ Justic told The Post, describing Olthof as “an angel” and “wonderful mom.’’

It was only after they “became intimate’’ that things went south — badly, she said.

Shields wrote bitterly on his fundraising page, which never raised a dime: “We were married and because she couldn’t find work as an artist ran back home to Holland after she was pregnant with my son devastating me.

“She only wants my son to be in the US for 2 weeks a year, which I just can’t accept as a father,” he complained.

Justic said Olthof told her that during one of James Jr.’s visitations with his father two years ago, Shields locked both the boy and Olthof in a room in his apartment.

“He said he wouldn’t let them go,” Justic said. “Little James was scared after, and Linda said his daddy was just sad because they were leaving.”

But Olthof was under court order to continue the visits.

Olthof and her son arrived in the city around July 21, preparing for the boy’s latest visit with Shields while first taking in a few quick sights, including Chinatown.

A friend flew in to join her several days later, and a photo on Olthof’s Facebook page shows her happily posing with a man at the South Street Seaport on Monday — apparently just hours before her murder.

“Hello lady Liberty,’’ the caption reads.

The pal realized something might be amiss Monday evening when he couldn’t get ahold of her, according to Shea.

The friend contacted Olthof’s sister in the Netherlands, and the worried sibling began surfing the Web — spying news reports about the Queens slayings, which hadn’t yet identified the victims by name but which included Shields’ address and other details about the dead.

“When [the sibling] saw those stories, she realized something had befallen her sister,’’ Shea said.

Shields’ father on Tuesday called his son “a good man, a good boy,’’ adding that Shields “kept everything secret’’ when it came to the custody battle over James Jr.

A doorman at Shields’ Score Rehabilitation business near Penn Plaza said the physical therapist was all about family.

“He was always inviting me to parties at his house. A nice little get together,’ he would say,” the worker said. “He always emphasized that. ‘Bring your wife, bring your kids if you want,’ ”

But Shields’ neighbors — and friends of Olthof’s — knew some of his darker side.

“He was not himself lately. He was like a Dr. Jekyll and Mr. Hyde person,’’ said upstairs neighbor Tony Bekan, 54, adding that Shields’ booze-fueled, late-night parties were notorious in the neighborhood.

Shea noted there was one domestic incident at the home in December 2017, with a 911 caller reporting “possibly things thrown around’’ and saying it wasn’t “the first time they heard fighting between the male occupant and female occupant.’’

Shields had fled by the time cops arrived at the house to check out the disturbance, and the woman who answered the door — Shea refused to say who — was uninjured and uncooperative, the cop said.

Additional reporting by Larry Celona, Lorena Mongelli and Kevin Sheehan