The incident occurred about 2:15 p.m. in a classroom filled with about 25 students at Ecole St. Laurent in Buckingham, Quebec, the Canadian Broadcasting Corp. reported. No one was hurt.
Gatineau police said the man, said to be about 30-35 years old, was arrested a short time later and a .22-caliber rifle was seized.
"He walked inside the school, and then he got into a class," police Constable Pierre Lanthier said. "The teacher was there, and he was really calm inside the class."
Police said they had not yet learned why the man brought the gun to the school. He is to appear in court Wednesday.