A Montgomery County 11th-grader sold marijuana from his family’s home in Gaithersburg — with the apparent blessing of his father — before the teenager was done in by more than 600 photographs he had posted online of him and his friends partying in the home, according to court documents.

Police said that there were 45 guns in the home, including an M16 assault rifle, and that the father had a loaded gun when a SWAT team raided the place Oct. 11.

“The house has been a problem house in the neighborhood, as some neighbors around the house have pointed out,” officers wrote in an arrest affidavit. The case was made public Thursday.

The father, Darel Gettier, 63, was charged with allowing a minor to have access to a loaded gun, keeping a disorderly house and “maintaining a common nuisance” by allowing his son to sell marijuana, according to court records.

Ethan Gettier, 16, was charged as an adult with firearms and drug offenses. Four others — a 20-year-old and three 18-year-olds — also were charged in the case. The four had either attended or graduated from Quince Orchard High School. The younger Gettier attends the school.

Darel J. Gettier (Montgomery County Police)

Reached by phone on Thursday, Darel Gettier said, “I’m not really making any comments,” and he declined to speak further.

According to charging documents, detectives were tipped off to trouble by the younger Gettier’s photographs.

“Specifically, Gettier had posted over 600 photos on Instagram showing parties he was having in the house with ample amounts of suspected marijuana and alcohol,” police wrote.

Undercover officers spent several weeks watching the house.

“During the school day, on many occasions, students would stop by the house during school hours,” police wrote, saying they suspected that the teens were buying marijuana from Gettier. “It was not uncommon to see between three and five cars pull into [the Gettiers’] driveway” over a few hours.

The two-story home on Triple Crown Road is about one mile south of Quince Orchard and about 10 miles northwest of the Capital Beltway. Neighbors said they saw many teenagers entering the house and suspected that underage drinking might be occurring there.

The arrests and charges shocked several neighbors, particularly the weapons allegations.

“I don’t think anyone had any idea about the guns,” said a neighbor who asked not to be identified to protect his privacy.

On Oct. 11, officers staking out the home saw a 2010 Hyundai pull up and watched the two occupants enter the house and come out. Officers trailed the car, saw it run a stop sign and pulled it over, according to court records.

Later that day, police and SWAT team members moved in on the house. Five juveniles were having a party.

“The house smelled strongly of marijuana,” police wrote, “and there is no way that Darel Gettier did not know that his son and juvenile friends” were smoking marijuana.

Police said that many of the weapons in the house were unloaded in an upstairs closet but that there was ammunition in the same closet. Darel Gettier kept a loaded .38-caliber handgun on a table while his son and his son’s friends were there, police allege.

Jennifer Jenkins contributed to this report.