It was still dark when Secret Service Agent Nathaniel Hicks heard a tap on his passenger’s side window early on July 11, 2015, and turned to find a police officer pointing a gun at him.

Hicks was on duty, parked in his Chevy Impala on the shoulder of the Baltimore-Washington Parkway waiting to join a motorcade for then-Homeland Security Secretary Jeh Johnson. His gun was resting in the passenger’s seat. His badge was in his pocket. Hicks says he threw up his hands.

“I said, ‘Whoa, whoa. I’m a Secret Service special agent,’ ” Hicks, who is African American and now retired, said in a deposition for a federal lawsuit he filed against the two U.S. Park Police officers who detained him.

Hicks says the ordeal should have ended there. Instead, Park Police officers Gerald L. Ferreyra and Brian Phillips detained him for an hour, causing him to miss Johnson’s motorcade. They eventually released Hicks — only to pull him over again for using his cellphone while driving, which is not against the law for police.

Hicks argues the real reason he was targeted was because he is black.

Now, a judge has ruled this week that a jury will be left to decide.

On Monday, U.S. District Judge Paul W. Grimm of Maryland found the actions of Ferreyra and Phillips may have violated Hicks’s Fourth Amendment protection against unreasonable seizures. Grimm ruled that the officers are not entitled to qualified immunity — which protects police as long as their actions are reasonably within the law — because they didn’t show probable cause to continue detaining Hicks.

But the case has another odd wrinkle: That morning on the Baltimore-Washington Parkway was not the first testy encounter between Hicks and Ferreyra. In 2009, Hicks assisted in detaining Ferreyra outside a Washington bar. Ferreyra had gotten into a fistfight with a cabdriver, according to court records.

Ferreyra, however, has maintained that this event had nothing to do with his decision to detain Hicks in 2015. Attorneys for the officers argue that all of their actions were within the law, and that the stops also had nothing to do with racial discrimination. (Ferreyra is Hispanic and Phillips is white.) They argue Hicks is actually seeking “vindication of a bruised ego resulting from quarreling among interagency law enforcement officers.” Ferreyra, in fact, said under a deposition that there has been ongoing “petty beef” between the Secret Service and Park Police for years.

“This dispute, to the extent one exists, is a matter best left to internal agency procedures for training (and, if appropriate, discipline), not federal civil-rights litigation,” the attorneys wrote in court documents.

The officers’ attorneys did not respond to multiple requests for comment. Nor did attorneys for Hicks, who filed the lawsuit in July 2016 and left the agency months later after a 20-year career.

On the morning Hicks was detained, the Homeland Security secretary was traveling from Washington to his home in New Jersey. Hicks was assigned as the “lead advance agent” in Maryland. In the event of an emergency, he would be in charge of guiding Johnson’s motorcade to the nearest hospital or designated safe house.

Hicks had just gotten off the phone with his supervisor, confirming the motorcade was on time, when he heard the tap on the window.

In Ferreyra’s telling, which Hicks disputes, Ferreyra found the Secret Service agent sleeping. When he tapped on the window, he alleges Hicks yelled, “Get that [expletive] gun out of my face!” and reached for his own service weapon. Ferreyra grabbed Hicks’s Glock out of the front seat, and Hicks then slowly handed him his credentials — but Ferreyra claimed he could barely focus as he read them. He was shaken up, he said, because “I almost shot a police officer.”

Ferreyra took Hicks’s credentials back to his cruiser for a closer look, “because I’ve had cases with police impersonators before,” he said in his deposition.

Hicks was definitely a Secret Service agent, Ferreyra confirmed.

But was he familiar?

On the night Ferreyra was arrested in 2009, around 3 a.m. outside the since-closed McFadden’s Restaurant and Saloon in Foggy Bottom, Hicks was the first law enforcement officer on the scene. A woman who witnessed the fight flagged down Hicks, who intervened and called the D.C. police, Ferreyra said. The charges were ultimately dismissed, according to court records. But back on the side of the Baltimore-Washington Parkway, Ferreyra claims he did not recognize Hicks, or even his name, he said in his deposition.

Rather than letting Hicks go, he decided to call for backup.

And as the second officer, Brian Phillips, questioned Hicks on the side of the road, allegedly quibbling over “their territory,” the motorcade finally came.

It slowed down, waiting for Hicks to join. But instead, Phillips allegedly “mockingly waved his hand goodbye at the motorcade as it passed,” as he stood outside Hicks’s cruiser, according to Hicks’s complaint.

“The totality of the circumstances, including the objectively hostile way in which Defendants treated Special Agent Hicks and the lack of any legitimate explanation justifying Defendants’ conduct reveals Defendants’ discriminatory motives,” Hicks’s lawsuit states.

Hicks was not free to go until Ferreyra’s supervisor arrived and spoke with Hicks’s boss. Grimm said in his order that he didn’t see any reason this was necessary. Instead, Grimm found, Ferreyra was “certainly” concerned about pulling his gun on a Secret Service agent — and perhaps called his supervisor for his own “personal interest.”

“Defendants still have not shown why they could not, in less than fifteen minutes, ascertain that Secret Service agents indeed are authorized to carry and transport their weapons in their vehicles, when a simple Google search would yield such information,” Grimm wrote.

Likewise, Grimm seemed perplexed as to why Phillips did not know that it is legal for police to use a cellphone while driving.

“I said, sir, you just had me detained for the last hour or so,” Hicks recalled in his deposition. “Why are you pulling me over again?” Hicks tried to explain he had orders to contact his supervisor as soon as police let him go. Phillips “responded to me by saying now you’re mouthing off again.”

Grimm threw out an additional claim by Hicks that the officers had conspired to violate his civil rights as revenge for Hicks’s apparent involvement in Ferreyra’s 2009 arrest, or because of “ongoing tensions between the [Park Police] and the Secret Service.” Attorneys describe an alleged “turf war” between the agencies in court documents, apparently related to the “petty beef” between the agencies that Ferreyra described in his deposition. Grimm found that there was not enough evidence showing that this “petty beef” would lead Ferreyra and Phillips to conspire against Hicks.

Ferreyra’s explanation for why “petty beef” exists between the Secret Service and Park Police was marked confidential and not accessible by The Washington Post.

A spokesman for the U.S. Park Police did not respond to questions about this alleged “beef” or about Ferreyra’s disciplinary records. But he confirmed that both men are still Park Police officers.

No trial date has been set yet.

More from Morning Mix: