A former secret service agent's lawsuit claiming that two U.S. Park Police officers unlawfully detained him because he is black, causing him to miss a motorcade for a Cabinet secretary, can move forward, a federal judge ruled Monday.

Secret Service Agent Nathaniel Hicks was waiting in his Chevy Impala on a Maryland interstate at about 6 a.m. on July 11, 2015, to join then-Homeland Security Secretary Jeh Johnson's motorcade when U.S. Park Police Officer Gerald L. Ferreyra approached.

Ferreyra "drew his gun, pointed the weapon at Special Agent Hicks, and began screaming at him," according to a lawsuit filed by Hicks in federal court in Maryland about a year later.

Hicks, who has since retired, was a 20-year Secret Service veteran at the time and was assigned as the Baltimore lead advance agent for Johnson's motorcade that day.

Hicks' Secret Service-issued car had a police antenna and a strobing bar, and he quickly told Ferreyra that he was a Secret Service agent, explaining that he was on duty and waiting to lead a motorcade, his lawsuit said.

Hicks handed over his credentials, which Ferreyra inspected while still pointing his gun at the agent. But after he confirmed Hicks was, in fact, a federal law enforcement officer, he didn't let him go and instead called for backup.

U.S. Park Police Officer Brian Phillips arrived and acknowledged that Hicks was a Secret Service agent. But the two men detained Hicks for over an hour, repeatedly telling him that he was not free to leave, Hicks' lawsuit said. During the detention, Ferreyra yelled at Hicks and "spoke to him in a degrading manner."

The motorcade passed about a half hour into the ordeal, slowing to allow Hicks to join, but he couldn't, the lawsuit said, adding that one of the officers on the scene "mockingly waved his hand goodbye at the motorcade as it passed."

When a supervisor arrived, he acknowledged that Hicks was a Secret Service agent and that he hadn't done anything criminal in nature, but didn't explain why Hicks had been held for so long.

Hicks was finally released, and unable to catch up with the motorcade, when he was pulled over again by Phillips, according to the lawsuit.

Phillips asked for Hicks' identification and car registration "despite just having had possession of these documents, and continued to talk to him in a demeaning and degrading tone with no possible justification," the lawsuit said.

When another officer spoke with Phillips, he decided to release Hicks "but not before throwing his identification and registration at him."

Phillips said he didn't recognize Hicks when he pulled him over after the initial detention, and did so because Hicks was on the phone and the car was swerving. Law enforcement officers can legally be on the phone while driving, and Hicks said he was not driving erratically.

Ferreyra said he had first approached Hicks' car and drew his weapon because there was a gun on Hicks' seat, according to court documents. Ferreyra maintains that he told Hicks he was free to go before the motorcade arrived.

Both officers argued that the lawsuit should be dismissed on the basis of qualified immunity, which protects police from civil damages as long as their actions are reasonably lawful and don't violate anyone's rights.

But U.S. District Judge Paul Grimm ruled that the officers have not proved why they couldn't let Hicks go before the motorcade arrived. Grimm wrote in his decision that the officers knew Hicks was a Secret Service agent at least 15 minutes before the motorcade passed, and could have easily determined through "a simple Google search" that he was authorized to have a weapon in his vehicle.

"It is clearly established that detaining a person under these circumstances — when the officers had a reasonable suspicion that criminal activity was underway but, after some investigation, became aware that no criminal activity was happening at the scene — is a violation of the individual's Fourth Amendment rights," Grimm wrote, while determining that parts of the suit should go to trial by jury.

Hicks said he "suffered, and continues to suffer, significant embarrassment, humiliation, emotional distress, and the deprivation of his constitutional rights."

"In addition to the manner in which defendants spoke to and treated him, it was particularly humiliating to be held on the side of the road as his colleagues passed by. That he was subjected to unlawful treatment because of his race compounds his emotional distress," Hicks' lawsuit said.

Hicks is suing for compensatory and punitive damages, to be decided by the jury.

Sgt. Eduardo Delgado with the U.S. Park Police said that he could not comment on pending litigation, but that both Ferreyra and Phillips were still employed with the department.

Attorneys for Hicks, Ferreyra and Phillips did not immediately respond to requests for comment regarding Grimm's decision.