A freelance American writer held captive for nearly two years in Syria by al Qaeda-linked militants was freed just days after a rival group beheaded another U.S. reporter and threatened to continue killing others.

Peter Theo Curtis, 45 years old, was released by the Nusra Front in Syria after the government of Qatar helped negotiate his freedom, according to his family and U.S. officials.

While...