(CNN) A 10-year-old boy was accidentally shot by his babysitter when she was taking selfies while holding a gun, a Texas sheriff's office said.

The boy was taken to a hospital in critical condition, but is recovering.

The incident occurred at an apartment in Houston on Tuesday evening when the 19-year-old relative who was watching the child found a gun, according to tweets from the Harris County Sheriff's Office.

Thinking the weapon was unloaded, the girl started posing and taking pictures with it, authorities said. That's when the gun went off, hitting the boy in the stomach.

The child was taken to the hospital in critical condition, Sheriff Ed Gonzalez tweeted.

Read More