“He would hit me when I was young,” said a cousin, Zied Bouhlel, a lanky young man, wincing at the memory. “He did it as a joke, but it ended up hurting. Every time he saw me, as a joke.”  Many recalled an episode when Mr. Lahouaiej Bouhlel, driving a rental car past the local bathhouse, was rear-ended by another car. Both drivers got out, and Mr. Lahouaiej Bouhlel proceeded to beat the daylights out of the other man.  “This was totally normal for him,” said Hamila Hassen, who witnessed the confrontation.  Mr. Lahouaiej Bouhlel had not been back in some four years, his brother Jaber said, adding that he had spoken with Mr. Lahouaiej Bouhlel often by Skype, taking advice about clothing and food.  Distraught, he showed a selfie his brother had sent him from Nice’s Promenade des Anglais just hours before the massacre occurred there, his brother’s lips twisted in a slight smile.  While acknowledging that Mr. Lahouaiej Bouhlel could become “very aggressive,” Jaber nonetheless insisted that his brother could not have committed the Nice atrocity.  Their father, Mondher Lahouaiej Bouhlel, refused to be interviewed. But by all accounts, relations between father and son were fraught.  “He would get mad with his parents over nothing,” recalled the psychiatrist, Dr. Chemceddine.  A crisis was reached when Mr. Lahouaiej Bouhlel deliberately locked his parents out of the family home. It was then that they went to see the psychiatrist.  Like many adolescents, Mr. Lahouaiej Bouhlel appeared concerned over his physical appearance. But the young man sitting in front of him obsessed over it.  “He wasn’t satisfied with the image of his body,” Dr. Chemceddine said. “‘I am ugly,’ he said. ‘I’ve got to build myself up.’”  “He seemed strange to me,” Dr. Chemceddine added. “He had an altered perception of reality.”  Around 2009, Mr. Lahouaiej Bouhlel moved to Nice, taking advantage of an arranged marriage to a cousin whose family lived there but was also originally from Msaken. The marriage was Mr. Lahouaiej Bouhlel’s ticket out of Tunisia, and he seized it.  By 2009, he had his French residency papers and a 10-year carte de séjour, or residency permit, which allowed him to work, according to a scan of the document. Soon he and his wife had a child.  After he got his documents, his treatment of his wife changed drastically, for the worse, according to neighbors.  “He married her to have the papers,” said one, who gave her name only as Deborah and lived several floors below the couple in a 13-story building. “He showed his real face afterwards.”  She said she was close to Mrs. Lahouaiej Bouhlel, and like her wore a hijab and had three children.  Mr. Lahouaiej Bouhlel was interested only in women and drinking, she added. “My husband never saw him at the mosque.”  By 2011 or 2012, he began to lead a double life, creating a false Facebook profile under the name Javin Bensucon. The most recent cover page was updated on Feb. 7, 2015.  He used the made-up identity to help him pick up women he often met salsa dancing, going to classes three times a week as well as going out for evening “soirees.”  He kept his salsa world completely separate from his family life, and he created a personality to go with it. In his Facebook profile, he was single, had gone to Cuba High and was from Bresilienne, a city in Haiti. He had 10 friends on the public part of his website, all of them glamorous-looking women.  He went out with multiple women, some of them 20 or more years older. He never told his partners that he was married or a father.  Patricia Marguerite Giliberto, 55, a regular salsa dance partner for nearly two years, pointed The New York Times to the profile under the alias. She said she had been shaken when she realized it belonged to Mr. Lahouaiej Bouhlel, and angry at herself for having been friendly at one time with a man who is now one of France’s biggest mass murderers.  “I knew nothing about his life,” she said. “I thought he was single. He always hid everything.”  One thing was clear, however: The insecure young man, once obsessed by his ugliness, was now fascinated by his good looks. “He viewed himself as a stud,” Ms. Giliberto said. “He was very confident about his attractiveness.”  When they corresponded on Facebook, she said, he asked her personal questions: “Where are you now? Is your skin against another person’s skin” — a way of asking if she was in bed with a lover.  Their chats were playful and affectionate. Ms. Giliberto called him Momo, and they often agreed on where to meet for dancing.  He did not have much money, and she always paid for drinks. Since she was so much older, she said, she thinks he saw her as a way to meet other, younger women.  A witness said the truck “crushed everyone in its path.”  When Ms. Giliberto met the man she later married, she began to distance herself from him, and Mr. Lahouaiej Bouhlel became rude and angry.  “You are not interesting to me, you are a problem woman,” he wrote in a text. Later he told her, “You are old.”  She did not hear from him again. That was just before 2013.  In the years after, his domestic life deteriorated. Although his wife had two more children with him, each time hoping that would rekindle the relationship, it did not.  Sometime after their first child was born, he began to hit her. Sometimes he also struck his mother-in-law, said Jean-Yves Garino, the wife’s lawyer.  “He was a narcissistic, perverted man, and he loved himself very much,” Mr. Garino said.  The neighbor Deborah said that Mr. Lahouaiej Bouhlel sometimes drank too much, and that his wife was often afraid of him. He would intimidate and demean her, she said.  She recalled a party with all of the neighbors one night, when he danced in a very seductive way with a 60-year-old woman in front of his wife.  Last year or the year before — Deborah was not sure — when his wife was observing the Muslim monthlong period of fasting and abstinence during Ramadan, “he poured alcohol on her head to humiliate her,” she said.  Around the same time, Mr. Lahouaiej Bouhlel stabbed one of his children’s toys with a knife, and his wife became fearful for her children and sought a divorce, Deborah said.  He moved out, and occasionally gave her some money to support the children, but not much and not often, said Mrs. Lahouaiej Bouhlel’s lawyer, Mr. Garino.  In Nice, Mr. Lahouaiej Bouhlel appeared on the police radar for theft and violence, most recently in January, when he got into a fight with another motorist and threw a wooden pallet at him.  Mr. Lahouaiej Bouhlel received a six-month suspended sentence in March. By then, he may have already been fixated on carrying out violence on a grandiose scale, Mr. Molins, the Paris prosecutor, said.  But it was only in the two weeks before the Nice attack that Mr. Lahouaiej Bouhlel began to research rather mundane Islamic topics, including information about Eid al-Fitr, the celebration that ends the month of Ramadan, Mr. Molins said.  He searched the internet for information on the Orlando attack by Mr. Mateen, who had professed allegiance to the Islamic State. But Mr. Lahouaiej Bouhlel also searched for information on the recent killing of five police officers in Dallas.  Mr. Molins said Mr. Lahouaiej Bouhlel’s photographs on his cellphone, going back nearly a year, included ones showing crowds on the Promenade des Anglais. One set of images showed the crowd during the Bastille Day fireworks a year ago, another a crowd at a concert on the promenade, also last year.  Also included was an image of a January article from the local newspaper, Nice-Matin. It was about a man who purposely drove his car into a terrace cafe in the old port.  Adam Nossiter reported from Msaken, and Alissa J. Rubin and Lilia Blaise from Nice, France. Jaber Belkhiria contributed reporting from Msaken.  A version of this article appears in print on July 25, 2016, on page A1 of the New York edition with the headline: Killer in Nice Long Drawn to Violence. Order Reprints| Today's Paper|Subscribe
Mohamed Lahouaiej Bouhlel, who killed 84 people in France, had long displayed a propensity for violence, and his life appears to show how the unstable have latched on to Islamic State propaganda.