A U.S. Marine will return to the Mexican prison where he has been held since March, after a Mexican judge ordered him back following the first hearing on weapons charges, according to Fox News.

Andrew Tahmooressi, a 26-year-old veteran of the Afghan war, has been held in Tecate, Mexico, since he drove into Mexico with military-grade weapons in his truck. Tahmooressi said he was lost and wasn't trying to leave the U.S., the Los Angeles Times reported.

After the hearing, Tahmooressi's attorney told reporters that, despite the ruling, the case was going in the right direction, saying that the former Marine's statements to the judge were "sound and made perfect sense."

The next hearing in the case is scheduled for Aug. 4, during which the judge could order Tahmooressi to be freed.

Fernando Benitez, the attorney, said he has some questions about the manner in which Tahmooressi was detained, which could ultimately see the case dismissed from Mexican federal court, Fox News reported.

Tahmooressi wasn't provided counsel or an adequate interpreter for the first eight hours of the ordeal. The warrant used to search the vehicle was dated March 28 but was executed March 31.

When authorities searched Tahmooressi's truck, he was carrying all his possessions -- including three registered guns -- because he was in the process of moving from Florida to San Diego for PTSD treatment.

It's illegal to bring guns into Mexico, especially military-grade weapons, which Tahmooressi had.

Dozens of people, including some congressmen, have appealed to the U.S. State Department and Mexican officials to free Tahmooressi. Rep. Duncan Hunter, R-Calif., and Rep. Lee Terry, R-Neb., sent a letter on July 8 asking for just that, according to Fox News.

"We believe the evidence supports Andrew's claim that he mistakenly entered into Mexico," the congressmen wrote. "One of the most compelling pieces of evidence is a 911 call Andrew made at the border checkpoint, where he stated he was unaware of his location."

Despite the calls for his freedom, Benitez said it's likely that Tahmooressi's trial will run its course.

"This is a federal court, and as in any democratic nation you will not find an executive calling up a judge and ordering the release of a suspect," Benitez told Fox News. "It makes no difference if it is a mayor, governor or the president, there's not a phone call in the world that will change this."