San Diego Padres pitcher Jacob Nix was arrested Sunday for criminal trespassing after trying to get into an Arizona house through a doggy door, prompting a resident of the home to kick him and use a stun gun on him, according to police.

San Diego Padres pitcher Jacob Nix. Police say Nix was arrested for trying to crawl through the doggie door of a home in the Phoenix suburb of Peoria, Arizona. Maricopa County Sheriff's Office / AP

Nix, 23, is accused of entering a fenced backyard in Peoria, about 13 miles north of Phoenix, and then trying to climb through a doggy door in the back of the house, according to court documents filed by the Peoria Police Department in Maricopa County.

Nix was kicked in the face by someone inside the home before fellow baseball player Tom Cosgrove, who plays for a minor league team, tried to pull him out, the documents said. As the pair began running away, the person inside the home "leaned out of the doggie door and deployed his taser," hitting Nix in his torso.

Police were called to the scene and found Nix and Cosgrove, 23, a couple blocks away from the house, they said. The two were arrested.

Nix told police that he thought he was at his own home, even though he doesn't have a doggy door and usually enters through the front door. He could not explain and would not elaborate further why he tried to enter someone else's house. Court documents said he was under the influence of drugs or alcohol.

Nix was charged with criminal trespassing and released on $100 bail, according to court records. He is next due in court on Monday. Cosgrove was also charged with criminal trespassing, released on bond and appeared in court on Tuesday, according to NBC affiliate KPNX.

Cosgrove pitched for the Lake Elsinore Storm, a minor league affiliate of the Padres, in 2019. Nix made his major league debut with the Padres in 2018, starting nine games for the parent club. He spent his entire 2019 in the minor leagues, playing for Padres affiliates the El Paso Chihuahuas and the Lake Elsinore Storm. Nix is assigned to the Peoria Javelinas for the Arizona Fall League.

In a statement released by the Padres on Thursday, the team said it was aware of the incident and takes the matter seriously. The team would not comment further pending legal proceedings.