A Mexican judge has ordered Marine Sgt. Andrew Tahmooressi to remain in custody on gun charges following a hearing.

More from Foxnews.com:

The 26-year-old veteran of two tours in Afghanistan was finally able to tell his story to a judge, after his case had been delayed by both Mexico's unpredictable legal system and his own trouble settling on a lawyer. It was not immediately clear what Tahmooressi said at the evidentiary hearing, which was closed to the public. 

Despite the judge's ruling, Tahmooressi's attorney, Fernando Benitez, told reporters that he was confident that the Marine's case was on the right track. Benitez claimed that irregularities with Tahmooressi's detention were grounds for dismissal of the case. The attorney said that his client was not provided with consular services for nearly eight hours after he was detained, nor did he have access to an adequate translator. 

Benitez had earlier sought to dampen hopes that federal Judge Victor Octavio Luna Escobedo would free Tahmooressi, although supporters, including his mother, Jill Tahmooressi, had held out hope.