The men drove up to the Culwell Event Center in North Garland, got out of their car and began shooting just as the "Muhammad Art Exhibit and Cartoon Contest" inside was coming to an end, Garland police spokesman Joe Harn said.
An unarmed security guard was shot in the leg. He was later treated and released from a hospital.
Police who were helping with security at the event fired back, killing both gunmen.
"The first suspect was shot immediately," Garland Mayor Douglas Athas told CNN. "The second suspect was wounded and reached for his backpack. He was shot again."
The gunmen's identities weren't immediately released.
"We have no other indication that anyone else was involved," Athas said.
FBI and local officials were checking on the gunmen's vehicle for explosives and the area around the center was blocked off.
Surrounding businesses, including a Walmart, were evacuated, as were attendees from the Curtis Culwell Center.
There is no immediate threat to the area, police said late Sunday night.
The check for explosives was a precautionary measure and could take some time.
"It's a very slow, tedious operation that goes on," Harn said.
Heavy security for event
The event was sponsored by the American Freedom Defense Initiative, which is considered an anti-Muslim group by the Southern Poverty Law Center
, which tracks hate groups.
The group said it specifically picked the venue, a public school-owned facility, because it was host to a event denouncing Islamophobia in January.
The Sunday night event invited cartoonists to send in cartoons of Prophet Mohammad. The group said it received more than 350 submissions. The winner stood to win $10,000.
There were about 200 people at the event, police said.
"Most of the people who were there were from out of state," Athas said.
Security was tight. The school district brought in extra officers, and the group itself hired several more.
Only those who purchased tickets ahead of time were admitted. They had to go through metal detectors.
"We were prepared for something like this," Harn, the police spokesman, said.
Depiction considered blasphemy
While details about the gunmen, including their religion or their motive, weren't immediately known, depictions of Prophet Mohammed are considered blasphemous by many Muslims.
The prohibition against illustrating the Prophet Mohammed began as an attempt to ward off idol worship, which was widespread in Islam's Arabian birthplace. But in recent years, it has taken a deadly toll.
In January, gunmen attacked the offices of Charlie Hebdo
, a French satirical magazine that has a controversial history of depicting Mohammad, and killed 12 people.
The next month, a gunman attacked a free speech forum in Copenhage
n, Denmark, featuring cartoonist, Larks Vilks, who infuriated al Qaeda with his depictions of Mohammed.
In the United States, cartoonist Molly Norris is still in hidin
g, four years after she depicted the likeness of Mohammed on several items, and was deemed a "prime target" for execution by Islamic extremists.
Shortly after the Sunday night shooting, a prominent Muslim leader in Dallas said tweeted that the incident was "just what we didn't want."
"The community stayed away from event," wrote Imam Zia Sheikh. "Seems like a lone wolf type of attack. Just what we didn't want."
'This is a war'
The keynote speaker at the Garland event was right-wing Dutch politician Geert Wilders who was placed on an al Qaeda hit list for his film "Fitna."
The film, which Wilders released online in March 2008 to international outcry, features disturbing images of terrorist acts superimposed over verses from the Quran in an apparent attempt to paint Islam as a threat to Western society.
In 2011, Wilders was cleared on charges of inciting discrimination and hatred over a controversial film he made about Islam.
The group, the American Freedom Defense Initiative, is considered an anti-Muslim group by the Southern Poverty Law Center
, which tracks hate groups.
Its president, Pamela Geller, is "the anti-Muslim movement's most visible and flamboyant figurehead," the SPLC says.
Geller took to her own website
shortly after the incident, writing, "This is a war. This is war on free speech."