One was a former high school basketball star who converted to Islam and was arrested for lying about his plans to join militants in Africa, the other was a one-time pre-med student and pizzeria owner who lived for a time in Pakistan and denounced Israel on social media.

Together, law-enforcement officials say, they teamed up to attack an event in suburban Dallas on Sunday that featured a contest involving cartoon drawings of the…