The redistricting process scrambled New York’s electoral field, forcing some incumbents to face one another in newly drawn districts, and leading to unforeseen intra-party squabbles.

First elected in 2010, Bronx State Sen. Gustavo Rivera moved districts after the new maps were set and now faces a primary challenger backed by the powerful Bronx Democratic organization.

Attorney Miguelina Camilo is running against Rivera in the Aug. 23 state Senate primary.

“Ultimately I’m saddened that they chose to support someone because of the relationship and the loyalty that they have to the party apparatus and not make a judgment based on the work I’ve done over the last decade,” Rivera told NY1.

Bronx Democrats Chair Jamaal Bailey, who represents a northeast Bronx state Senate district, said the party agreed to endorse Camilo earlier this year when she was going to run in the 36th District — which stretched from Riverdale to Throggs Neck in the Democratic-drawn maps.

But after an upstate court ordered the district lines to be redrawn, it made more sense for her to run in the 33rd District, Bailey said. That district is more condensed, running from Riverdale to the Bronx Zoo.

“Supporting Miguelina is a continuing endorsement. We are looking at it like that. From that perspective,” Bailey said. “Miguelina owns property in the district that she is running in. She has been a resident of that district for quite some time.”

Party leaders say they offered to support Rivera if he ran in the adjacent 32nd District — further south than his current central Bronx district — but he refused.

“There were quote-on-quote ‘options’ on the table, and I say options because none of these seats belong to any of us, so they can’t be offered to one person or another,” Rivera said. “I chose to not run in the 32nd District or the 34th District, which was also an option presented to me, because I really don’t have that deep a connection to that part of the Bronx.”

Rivera has not always gotten along with fellow elected officials from the borough. Just this year he supported an insurgent candidate against longtime Riverdale Assembly member Jeffrey Dinowitz, a top figure in the Bronx Democratic party.

“I supported him every time he ran. But do we agree on all political issues? No, he is very far to the left,” Dinowitz said. “He is a captive of the Working Families Party, he does support BDS, he does support defund the police. I don’t agree with him on those issues. But it’s more than that. It’s very simple. Miguelina Camilo is running, she has been running, and he decided to go into a different district and run against her.”

“That doesn’t make sense to me,” Dinowitz added.

For her part, Camilo says she’s focused not on infighting but on her race, something she has been doing for the last several months.

“The narrative that I am choosing to run now, and have the opponent that I do, I want people to understand I have been campaigning since February, and that is really when the race began for me,” Camilo said.

Rivera landed some key endorsements in the race already, including the teachers’ union and the powerful healthcare union 1199SEIU. He also has the backing of state Senate Majority Leader Andrea Stewart-Cousins.

The primary is Aug. 23.