People who knew Orlando nightclub shooter Omar Mateen describe him as a man who had many demons and potentially led a double life. (Video: Erin Patrick O'Connor, Jayne Orenstein, Thomas LeGro/The Washington Post, Photo: Associated Press/The Washington Post)

After a lifetime of angst and embarrassment, Omar Mateen was on the verge of realizing a longtime dream in the spring of 2007.

He was about to graduate from a Florida training academy that would put him on a path to being a police officer. He had left behind his youth as a pudgy, often-bullied kid to become a bulked-up bodybuilder. He was learning how to shoot a gun. Now it was all about to fall apart.

At a class barbecue, Mateen told a fellow cadet he was “allergic” to pork, and he got teased about it. Mateen blew up, recalled several cadets who were present, and said he couldn’t eat anything off the grill.

“I asked him if he was Muslim and he denied it,” Roy Wolf said. “I said, ‘It doesn’t matter to me if you are.’ . . . He got mad, really angry.”

A short while later — just a week after the Virginia Tech shooting that left 32 victims dead — Mateen asked a classmate whether he would report him if he brought a gun to campus, documents show. The next thing students knew, Mateen had been kicked out of the academy for a pattern of sleeping in class, plus the gun threat, which officials described in documents as “at best extremely disturbing.”

Mateen was never charged, and so the incident became one more anecdote in a life punctuated by many such moments, outbursts when his insecurities and inner conflict erupted into rage — a pattern culminating Sunday at a gay nightclub in Orlando in the worst shooting in U.S. history.

Mateen appeared conflicted about his religion and his sexuality, according to dozens of interviews with those who knew him. He married twice, each time to a woman he had met online, even though he also seemed drawn to gay life and culture.

Often, he was able to mask his internal turmoil well enough that some friends and neighbors are now stunned to learn that the person they knew became a killer.

But over the years, Mateen’s inner conflict seemed to explode again and again — not only at the training academy but also toward classmates, toward co-workers, toward his first wife and finally toward the 49 strangers he left massacred on the bloody floor of the Pulse nightclub.

Casualties of America’s worst mass shooting

Growing up in Florida

Mateen’s childhood in the coastal Florida town of Port St. Lucie was filled with ice cream from McDonald’s and trips to the mall. Every year during the holy month of Ramadan, the town’s few Muslim families would get together to share meals.

Mateen and his three sisters stood out as the children of Afghan immigrants in a small Florida town but seemed like “an all-American family,” said Sarah Zaidi, who grew up as best friends with Omar’s sister Mariam.

“They were pretty moderate as Muslims,” she said. “None of the sisters or mom even wore a headscarf like some Muslims do.”

But friends and neighbors recall that Mateen was a troubled child, often unpredictable, angry and sometimes threatening. As Zaidi later recalled, “He had lots of issues for a long time.”

William Winkler, 30, of Orlando was a classmate of Mateen’s at Mariposa Elementary, where his mother taught Mateen in fourth and fifth grades.

Winkler recalled Mateen taking other kids’ toys and acting like a bully, especially toward girls. Winkler said that Mateen acted superior to others and that teachers had great difficulty with him.

“I do remember the teachers at the school wanting to get him help desperately, as he was just such an angry kid,” said Winkler, who remembered Mateen having few friends. He was not sure whether Mateen was ever diagnosed with any learning difficulties but remembers him frequently requiring one-on-one tutoring with teachers.

“My mom tried to speak with his parents about him being angry, but they were very dismissive,” Winkler said.

Mateen’s father dropped his son off at school every day, Winkler said, and he had a reputation for being disrespectful of female teachers and dismissive of complaints about his son.

Disruptive, bullied teen

On Sept. 11, 2001, Mateen was 14 and a sophomore at the Spectrum alternative school, a campus in Stuart, Fla., for students with behavioral issues.

Months earlier, he had been expelled from Martin County High School for a fight with another student in math class, public records show. He was charged with battery and disturbing school functions. Officials declined to prosecute, but Mateen later listed the incident on job applications as an adult.

On the morning of the 9/11 attacks, one former classmate recalled a teacher turning on a television and the students watching as the second plane hit.

“[Mateen] was smiling. It was almost like surreal how happy he was about what had happened to us,” said the former classmate, who did not want his name used, because he did not want people to know he attended a school for poorly behaved students.

After watching the second tower get hit on a classroom TV, Mateen stood up and claimed that Osama bin Laden was his uncle, said the classmate, whose account was corroborated by others.

“Back then, we didn’t even really know who Osama bin Laden was,” he said. “But he talked about shooting AK-47s. . . . He said he shot them and his uncle taught him how to shoot them.”

The classmate recalled other students becoming angry. “The teacher could tell we wanted to hurt him, so the teacher grabbed him” and sent him to the dean’s office, he said.

Mateen’s father was called and came to pick him up. “I remember his dad walking up,” the classmate said. “And in the courtyard in front of everyone, the dad slapped him right across the face.”

Other classmates described Mateen as disruptive, but some said he was more of a class clown than a troublemaker. Several said that Mateen, who was overweight, often got picked on.

“He was brutally bullied,” said Justin Delancy, who said he rode the school bus with Mateen for several years. “He was a chubby kid and got bullied about his weight. He was probably one of the only kids of [Afghan] descent. That made him stand out a bit as well.”

“He was eccentric,” Delancy said. “He was just one of those guys that people wanted to bully because he was a pushover. He’d try to get a seat [on the bus]. Couldn’t get a seat. Someone would slap him on back of head. He’d try to joke and laugh and make fun of himself to get the attention off of himself. But it didn’t work.”

Those who knew Mateen then said they saw nothing to suggest that he was especially religious or observant of his Muslim faith. One recalled going to Mateen’s house and being surprised to see Mateen pull out a mat and pray.

Addis Wilson, a classmate at Martin County High, said Mateen played football for a short time and was a “typical high school kid,” Martin said. “I never saw signs of religious stuff. Never dressed a certain way. Never said anything homophobic.”

Kenneth Winstanley, a friend of Mateen’s in junior high and high school, said he never saw signs of an extremist ideology and did not believe Mateen could have celebrated 9/11.

“I know Omar liked America,’’ he said. “Omar explained the Muslim religion to me. He didn’t go crazy into it. It was just some of the things his culture does, the food they eat. Nothing radical Islam at all.’’

His parents

Mateen’s father, Seddique Mateen, is an outsize personality and polarizing figure in the Afghan community. He has grandiose notions of his own influence in Afghanistan and has expressed contradictory views on Afghan politics and the Taliban, experts in Afghanistan and the United States said.

The elder Mateen has posted his opinions on Facebook and in lengthy programs on a satellite TV channel aimed at the Afghan immigrant and exile community. He has used these platforms to promote his self-styled political ambitions, sometimes posing in military fatigues or acting as if he is the Afghan president.

Barnett Rubin, an Afghanistan specialist at New York University who has served as an adviser to the State Department, described Mateen as “delusional.”

“He has no coherent message,” Barnett said. “He represents nobody. He has no political significance in Afghanistan.”

The elder Mateen said in an interview this week his son was “a very respectful person.”

“He respected his family,” he said, “especially the parents.”

Seddique Mateen, who favors dark suits with floral ties and colorful pocket squares, was a regular at a mosque in Fort Pierce, Fla., and donated generously to it, friends said. He, his son and grandson would go to the mosque together at prayer time.

But in private, there were signs of domestic discord. In December 2002, the elder Mateen called police to report that during an argument, his wife had cursed at him, pulled his hair and pinched his bicep, leaving a red mark, according to a police report. Shahla Mateen was charged with domestic battery, but officials declined to prosecute.

New name, new body

After a few months at Spectrum, Omar Mateen returned to Martin County High. He graduated in 2003 from the county’s adult vocational school, where struggling students get their GEDs.

His early work history reads like the minimum-wage wanderings of a young man without much direction.

From 2002 to 2006, he worked as a bagger at Publix, a cashier at Chick-fil-A, at Circuit City, Walgreens and Nutrition World, as an assistant at Gold’s Gym and a sales associate at Hollister Clothing and General Nutrition Center (GNC).

At the same time, Mateen changed his name. His birth name, Omar Mir Seddique, followed Afghan tradition and means “Omar, son of Seddique.” But in August 2006, he went to court and legally added the ­Mateen surname to the end of his name, more in keeping with modern Afghan and American style.

Friends and co-workers gave conflicting reports about Mateen’s religiosity and personality at the time. Some said he was extremely pious and serious, but others described him chasing girls, going to parties and drinking.

“He was fun,” said Ryan Jones, 27, who said he often hung out with Mateen.

Mateen hung out at the mall with an openly gay former classmate, Samuel King, and many of King’s gay friends.

“He had to know [we were gay], but I never got any sense of homophobia or aggression from him,” King said.

Mateen was also quickly starting to transform himself physically.

Friends at the time said the chubby teenager, who stood just under 6 feet tall, was working out constantly and starting to add massive amounts of muscle — with a little help from chemical “juice.”

Margaret Barone, a former manager of the GNC where Mateen worked in 2006, recalled Mateen as a sweet young employee who always called her “Miss Margaret.” She said she and other employees always assumed Mateen was gay.

She remembered Mateen and other employees talking about drugs they had taken and Mateen saying that he had taken ecstasy. Barone recalled another employee, an assistant manager who was also Muslim, becoming upset after going out with Mateen a few times and seeing him drink to the point of blacking out.

“He said he didn’t like the things Omar was doing,” she said. “He says to me: ‘He gets too crazy. He blacks out. He starts fighting. He didn’t care whether he got beat up or killed, the way he was acting.’ ”

Barone also remembered Mateen’s outward transformation.

“If his arms were 20 inches, he had them over 40,” she said. “He was doing massive steroids that he said he was getting through the mail. He’d come in and buy $50 or $60 worth of protein powders, and also the supplements we sold.”

In school documents dating from 2015 obtained by The Washington Post, Mateen acknowledged that he had “experimented with marijuana” when he was a juvenile and had used steroids.

“This kid bulked up so fast and so quick that he had stretch marks on his skin,” Barone said. “When I tell you he bulked up, oh my Lord, it was like seeing a puny little kid turn into the Hulk.”

Career goal

At the same time that he was building his body, Mateen now seemed, at age 19, to have a strong idea about what he wanted to do with his life.

He wanted to be a police officer. He seemed almost obsessed by it, friends said.

He enrolled at Indian River Community College and earned an associate degree in criminal-justice technology in August 2006. His transcript shows that he finished with a 2.76 grade-point average, including a C in a class on “deviant behavior.”

In a series of undated Myspace photos that have surfaced since the shooting, he is seen taking selfies wearing New York Police Department shirts.

He left GNC in the fall of 2006 because, he later wrote on a job application, “I wanted to start preparing to become a police officer. I found law enforcement related work.”

That work was at the Martin Correctional Institution in Indiantown, Fla., a state prison for adult male inmates where he earned $14 an hour as a correctional officer.

In one glowing letter of recommendation, Port St. Lucie police officer Steven J. Brown, who said he knew Mateen from his days working at Gold’s Gym and GNC, wrote that Mateen’s character was “beyond reproach” and his “judgment, work ethic, sensibility, and problem solving are impeccable.”

“I would sleep soundly at night knowing that a person like Omar is protecting us [from] the element which resides behind your concrete and [steel] walls,” Brown wrote. Efforts to reach Brown for comment were unsuccessful.

On Oct. 27, 2006, public records show, Mateen swore an oath “to uphold the Constitution of the United States and the State of Florida” and “perform my duties faithfully and in accordance with my mission to ensure the public safety.”

But his dream lasted only a few months. In April 2007, he was dismissed, according to public records. The reason is not clearly stated in records, but some who knew him then believe it was because of the alarming threats he made at the training academy.

New job

Mateen had been hired at the prison on probationary status. Meanwhile, he was also attending a training academy for police, firefighters and corrections officers at Indian River State College.

It was there that Mateen would learn how to shoot a gun accurately (“We had to hit center mass — shoulders, arms, they didn’t count,” a former student said) before he was kicked out for the gun threat in the jumpy days after the Virginia Tech shooting.

Though the incident was documented in academy and Florida Corrections Department records, Mateen was never charged.

With his record still clean, Mateen was free to pursue another version of his dream, if a diminished one: In September 2007, he started work at the London-based G4S, one of the world’s largest security firms, with 623,000 employees in 110 countries.

Mateen became a licensed security guard with a permit to carry a concealed weapon, records show.

While working as a guard, Mateen was captured on a hidden camera for a 2012 documentary about the BP oil spill. “Everybody’s just out to get paid. They’re, like, hoping for more oil to come out and more people to complain so they’ll have a job,” he said with biting cynicism. “They want more disaster to happen. That’s where their moneymaking is. . . . All about the money.”

Once an overweight kid who’d been bullied on the school bus, Mateen was now a hulking bodybuilder packing a gun.

He wasn’t quite a police officer, but nobody was pushing him around anymore.

Starting his own family

Mateen also found a wife.

In April 2009 in Port St. Lucie, he married Sitora Yusifiy, a New Jersey real estate agent who said she met Mateen through an online dating service.

At first, she said, they lived with his parents and he seemed “normal,” but then the physical and emotional abuse started.

“He was not a stable person,” she said. “He beat me. He would just come home and start beating me up because the laundry wasn’t finished or something like that.”

She said he would slap her with an open hand and pull her hair.

Yusifiy said Mateen was not a devout Muslim and preferred spending his free time working out at the gym. She said she never saw signs that he held radical beliefs.

They separated after just nine months.

In September 2011, three months after his divorce was final, Mateen remarried, to another woman he met online.

Noor Zahi Salman, now 30, is a Palestinian American who was raised in Rodeo, Calif., about 25 miles north of Oakland, in an ethnically diverse, middle-class neighborhood of manicured ranches and split-level homes.

A neighbor recalled Salman as friendly, stylish and outgoing and said she played softball growing up with his children. The neighbor said Salman’s mother wore a hijab but not a face-covering veil, and he described them as “modern Muslims.”

Other friends also remember Salman and her sisters as “doctor smart” and “some of the smartest ladies I’ve ever met.”

Mohamed Diouf, 23, a family friend who also grew up in a Muslim home, said the Salmans were devout but not unusually so, just like his family. He said they would fast for Ramadan and pray and occasionally wear the hijab.

Salman and Mateen were married by an imam. It was Salman’s second marriage.

On the day of the wedding, neighbors said Salman wore her wedding dress for photos on the front lawn outside the family home, a greenish-beige split-level with a blue Hand of Fatima, believed to ward off Satan and evil spirits, by the front door.

Mateen and Salman moved to a two-bedroom condo he owned in Fort Pierce, in a quiet neighborhood where small, one-story homes are separated from narrow roads by neat, green lawns.

A year later, in September 2012, Salman gave birth to a son.

Like its neighbor, Port St. Lucie, Fort Pierce has little of the wealth seen in other nearby Florida coastal enclaves, and it is better known for car dealerships and strip malls than five-star beach resorts. It’s the kind of place where working-class people can still afford a nice, pastel-colored home amid the palm trees.

Mateen seemed to fit in easily, friends said.

He made two religious pilgrimages to Saudi Arabia, in 2011 and 2012, said Saudi Foreign Minister Adel al-Jubeir on Friday, but “there was nothing derogatory in terms of how” he participated in Muslim rituals.

In both cases, Jubeir said, Mateen was similar to 6 million Muslims who travel each year to Mecca to perform umrah — a pilgrimage done individually that is recommended but not compulsory for pious Muslims. Umrah, which can be done at any time, is distinct from the hajj, the annual pilgrimage that takes place in the last month of the Islamic calendar and is required of all Muslims at least once in their lives, if they are physically and financially able.

He stayed “a week or so. . . . He came back to the United States and that was it,” Jubeir said. At the time, “he wasn’t on our radar screen” for any reason. Jubeir cautioned that he had not deeply delved into the issue with Saudi intelligence but that the Saudis were cooperating with the FBI.

Mateen occasionally attended the Islamic Center of Fort Pierce, said Imam Shafiq Rahman, sometimes coming to prayers with his father and young son. His three sisters were active volunteers at the mosque, which has about 150 congregants.

“He was the most quiet guy — he never talked to anyone,” Rahman said, gripping a loop of black and red prayer beads. “He would come and pray and leave.”

But Rahman’s 20-year-old son, a University of Florida senior who declined to provide his first name, recalled Mateen as an “aggressive person.”

“It was just his demeanor,” he said. “He used to work out a lot.”

His sexuality

From as early as his days at Indian River Community College, some friends and co-workers wondered whether Mateen was gay. Some simply assumed it.

One former classmate at the college told the Palm Beach Post that he believed Mateen was gay and that Mateen once tried to pick him up at a bar.

The classmate, who is gay but was not out yet in 2006, said he and Mateen and other classmates would sometimes go to gay nightclubs after classes. On one such evening, the classmate said, Mateen asked him whether he was gay, which he denied.

“He said, ‘Well if you were gay, you would be my type.’ I said okay and just went on with the night,” said the classmate, who was not identified by the newspaper. “It was not anything too crazy, but I take that as a pickup line.”

David Gonzalez, 34, a gay man who lives next door to Mateen’s parents, remembers how Mateen used to look at him “in a certain way like he wanted me to approach him. He knew I was gay.”

If Mateen were interested in men, it would have been difficult to tell his father.

The elder Mateen has expressed strict conservative views about homosexuality, posting a video on his Facebook page saying that “God himself will punish those involved in homosexuality. This is not for the servants” of God.

Seddique Mateen said he didn’t believe his son was gay, telling reporters, “I don’t believe he was a whatever-you-call-it.”

He said his son Mateen had become enraged a few months earlier at the sight of a pair of gay men being affectionate with each other.

“We were in downtown Miami, Bayside, people were playing music. And he saw two men kissing each other in front of his wife and kid and he got very angry,” he told reporters. “They were kissing each other and touching each other and he said: ‘Look at that. In front of my son they are doing that.’”

But a number of men have told media outlets in the past week that they traded messages with Mateen on gay dating apps such as Jack’d.

A spokesman for Jack’d said the company has no record of a registered user named Omar Mateen or any email address connected to Mateen, though users frequently register under alternative names. The Washington Post was unable to independently verify that Mateen had used the app or any others targeted to gay men.

One Orlando man, Cord Cedeno, 23, told The Post that Mateen reached out to him on Grindr, another gay dating app. Cedeno said Mateen tried to flirt with him but he was not interested. “It was the picture of him wearing a tie,” Cedeno said. “I blocked him.”

When asked for comment, a Grindr spokesman said the company does not comment on ongoing investigations and always cooperates with authorities on legal matters.

FBI attention

For years, Mateen’s $12.75-an-hour job at G4S was about the only steady thing in his life. Starting in 2007, he worked as a contract security guard for the company at a facility for juvenile delinquents, a gated community on a golf course and other locations.

In 2013, he was working security at a local courthouse when he told co-workers that he had family connections to al-Qaeda and was a member of Hezbollah, according to the FBI.

To those familiar with the Middle East, those claims are contradictory — the two groups are bitter enemies. But to Mateen’s co-workers, the claims were scary and realistic enough to report Mateen to the county sheriff’s office, which passed the tip along to the FBI.

The co-workers also reported that Mateen also told them that he had mutual acquaintances with the Tsarnaev brothers, who were responsible for the Boston Marathon bombings. He also spoke of dying a martyr’s death.

The FBI opened what is known as a preliminary investigation — one of hundreds that the bureau handles at any one time and that typically last six months. The bureau extended the investigation once after the first six months, and Mateen was placed in a terrorism database. FBI officials declined to say whether the bureau also placed him on the no-fly list.

The bureau put Mateen under surveillance, recording his calls and using confidential informants to gauge whether he had been radicalized.

When interviewed by the FBI, Mateen claimed he made the statements in anger because his co-workers were teasing him about being a Muslim and he felt discriminated against. Eventually, bureau officials were satisfied that Mateen had “said these things to try to freak out his co-workers,” according to FBI Director James B. Comey.

After 10 months, the investigation was closed.

But Mateen’s name popped up again months later in a separate probe, this one looking into ­Moner Mohammad Abusalha, an American who flew to Syria in 2014, burned his U.S. passport and blew himself and others up in a suicide operation for an al-Qaeda affiliate.

Officials, however, said they did not find any significant ties between the two men, who attended the same mosque in Fort Pierce.

His last days

Investigators tracing the ­often-conflicting details of Mateen’s life are still struggling with the “why” of his rampage Sunday. Was he a radicalized Islamist militant, or was that just bravado? Was it Islamic State ideology or some personal demon that drove him to target gay people? Was it something else entirely that snapped in Mateen’s troubled mind?

The “why” is elusive, but investigators have learned a few key details about the final days of his life:

Mateen purchased an assault-style rifle and a handgun at a Port St. Lucie gun shop in the first week of June.

At some point, Salman accompanied Mateen on a shopping trip to buy ammunition.

Between June 5 and 9, Mateen and Salman traveled to Orlando and visited Pulse, the popular gay nightclub, for “reconnaissance.”

Last Friday, June 10, Mateen went to the Fort Pierce mosque to pray and spent more than an hour there with his 3-year-old son.

On Saturday, Mateen posted messages on Facebook pledging allegiance to Abu Bakr ­al-Baghdadi, the leader of the Islamic State terrorist group.

“America and Russia stop bombing the Islamic state,” he wrote. “I pledge my alliance to abu bakr al Baghdadi . . . may Allah accept me.”

He added: “The real muslims will never accept the filthy ways of the west,” and, “You kill innocent women and children by doing us airstrikes . . . now taste the Islamic state vengeance.”

That evening, as Mateen was preparing to leave their Fort Pierce home, Salman warned him against anything he might be planning.

Then Omar Mateen got into his car, drove to Orlando, and walked into the nightclub.

The scene in Orlando after a gunman opened fire at a nightclub

An injured person is escorted out of the Pulse nightclub after a shooting rampage, Sunday morning June 12, 2016, in Orlando, Fla. A gunman wielding an assault-type rifle and a handgun opened fire inside a crowded gay nightclub early Sunday, killing at least 50 people before dying in a gunfight with SWAT officers, police said. It was the deadliest mass shooting in American history. (AP Photo/Steven Fernandez)

Contributing to this report were Stephanie McCrummen, Abigail Hauslohner, Mary Jordan, Zachary Fagenson and Brian Crowley from Fort Pierce; Anne Hull, Matt Zapotosky and Arelis R. Hernández from Orlando; and Adam Goldman, Julie Tate, Alice Crites, Jennifer Jenkins, Amy Brittain, Karen DeYoung and Mark Berman from Washington.