The brother of the Parkland, Florida, school shooter has been barred from possessing guns and must undergo mental health counseling as part of his sentencing related to trespassing on the campus.

Zachary Cruz, 18, the younger brother of Marjory Stoneman Douglas High School shooter Nikolas Cruz, was arrested for trespassing March 19 while skateboarding on the campus. Police said they had warned him to stay away from the school, but that he had visited three times since the Feb. 14 shooting that killed 17 people.

In a statement read by his lawyer, Zachary Cruz said he just wanted to "try to make sense of this." He also apologized "to anyone who felt scared or threatened by his presence" on the campus. On Thursday, he pleaded no contest to the trespassing charge and was released from Broward County Jail after also being sentenced to six months of probation.

Susan Stocker / AP

Zachary Cruz, brother of Nikolas Cruz, is escorted into the courtroom for a hearing on March 29, 2018.

His attorney argued that he was being punished for his brother's crimes and that his $500,000 bond was unconstitutional.

Conditions of his probation also include refraining from contact with the victims' families and wearing a GPS monitor.

Florida's Baker Act, which allows officials to prohibit individuals who potentially pose a threat from buying or owning firearms, became law just one week before Zachary Cruz's arrest.

The shooting at Marjory Stoneman Douglas precipitated a national debate over gun violence that swept up elected officials and high school students across the country, culminating in a nationwide march on Saturday that drew hundreds of thousands of people.