The brother of Nikolas Cruz, who is accused of killing 17 people last month at Marjory Stoneman Douglas High School in Parkland, Fla., was arrested on a trespassing charge at the school on Monday afternoon, the authorities said.

Deputies with the Broward County Sheriff’s Office stopped the brother, Zachary Cruz, at about 4:30 p.m. after he rode a skateboard onto school property. Mr. Cruz, 18, told the deputies that he decided to visit the school to “reflect on the school shooting and to soak it in,” according to the sheriff’s office.

Mr. Cruz was arrested on one count of trespassing on the grounds or facility of a school, a misdemeanor. The sheriff’s office said that school officials had ordered Mr. Cruz to stay away from Stoneman Douglas High. It was not immediately clear when Mr. Cruz had received those warnings.