An armed church pastor in Detroit shot and killed a church member who entered the church wielding a brick during Sunday service.

Police say Deante Smith attacked the pastor who shot him dead with a fully loaded Glock pistol.

The unidentified pastor was taken into custody after the shooting. He was released early Monday.

Church pastors aren’t usually armed to the teeth during church service, but the pastor and the victim knew each other — and not in a good way.

Police are investigating allegations that the pastor was having an affair with Smith’s wife.

“We’ve heard several allegations and are looking into that, but haven’t substantiated anything,” Assistant Chief Steve Dolunt told the Detroit Free Press.

The pastor ran The City of God church out of a small storefront building on Grand River Avenue. Witnesses say Smith entered the brick building and “went after” the pastor with a brick in his hand.

Smith was shot multiple times at 1:45 p.m., about 15 minutes after the church service got underway. He died from gunshot wounds to the chest.

Smith’s family defended him against allegations that he was a homicidal maniac.

“It’s unbelievable,” Smith’s cousin, Detrese Abbot, told the Free Press. “They’re painting him to be a monster, but he wasn’t. They knew each other very well. This is not just a strange man that walked in looking to harm someone. … We’re just trying to figure this whole thing out.”

Abbot said the pastor was trying to help Smith.

“The pastor took him under his wing, he was his mentor,” Abbot said. “He was someone my cousin looked up to as a father figure. … So much happened that led up to this. I just don’t understand none of this.”

Abbot said Smith was a member of the church for the past 4 years. She said Smith and his wife had marital problems and he eventually filed for divorce.

“Divorced and Happy,” Smith wrote in a Facebook post on Sept. 15.

But Abbot said the couple weren’t actually divorced. She said Smith was trying to work on his marriage and the couple had reconciled before he was killed.

But Smith suspected the pastor and his wife were having an affair.

Smith posted a threat on Facebook, saying he would be at the church on Sunday. “I’LL BE THERE WITH THE TRUTH,” he wrote.

“He had been saying it for a couple days now, that the truth is going to come out,” Abbott told the Free Press.

“It’s crazy because everyone was living a normal life, like they didn’t know what was going on between his wife and pastor,” Abbot said. “It really hurt him.”

Smith was a talented athlete who played for the semi-pro Michigan Lightning football team in Detroit.

The team released a statement on Facebook on Monday.

“His infectious smile and the courage in which he approached life, on and off the field, are attributes that will stick with all of us,” the statement said.