Religion was absolutely a compounding motive.  He had a beef with an ex in-law who wasn't even at the church.  If it was solely a domestic issue the victims would have all been party to that issue.  Instead he shot nearly every person in that church.