Melecio Lopez-Hernandez, 39, encountered a Border Patrol agent in the brush near Freer, Texas, on Feb. 7. The agent tried to detain him but Lopez-Hernandez struggled, grabbed the agent's flashlight from his vest, verbally threatened him and then hit him in the head with the light, according to the Justice Department.
The agent sustained injuries and Lopez-Hernandez was arrested. He pleaded guilty on April 30.
"At the hearing, the defense attempted to convince the court [Lopez-Hernandez] thought the officer was a cow and was startled when he appeared," the Justice Department said. "[U.S. District] Judge [Marina Garcia] Marmolejo was not persuaded."
Lopez-Hernandez is expected to face deportation proceedings after serving his sentence. He will remain in custody pending transfer to a U.S. Bureau of Prisons facility.
Freer is roughly 63 miles northeast of Laredo, which sits on the Texas-Mexico border.