The incident happened around 3 p.m. at Grace Covenant Church in Chantilly, Fairfax County, FOX 5 of Washington, D.C., reported.
The pastor and a church member were later treated for non-life-threatening injuries, while another church member was only slightly injured, the report said.
Fairfax County police Chief Edwin Roessler, who was participating in the class, was also injured while taking the suspect into custody, according to FOX 5.
The two wounded church members had intervened when the suspect went after the pastor, the report said.
“We are grateful for the courage exhibited that prevented worse from happening,” church officials said in a statement. “Lastly, we want to thank the broader community for their outpouring of concern and support in this time.”
Authorities did not release the names of the suspect or the wounded people. Numerous people were inside the church at the time, FOX 5 reported.
Chantilly is about 25 miles west of Washington.
The Associated Press contributed to this story.