Kim Jong Nam is believed to have met with an American intelligence agent before he was killed.

Before the half brother of Kim Jong Un was killed in a brazen nerve agent attack at a Malaysian airport in 2017, he was known as a playboy and a hustler - not a secret CIA informant.

Kim Jong Nam, the exiled firstborn son of the late North Korean dictator Kim Jong Il, lived among the gamblers and gangsters of the Chinese enclave of Macau.

Because he was the only high-profile member of the Kim dynasty living outside the territory and employment of the regime, Japanese and South Korean reporters would flock to him on sight. He was a bon vivant who enjoyed expensive watches, wine and cigars. On Facebook, he posted photos of himself outside various casinos and resorts. "Living Las Vegas in Asia," he captioned one.

But behind the veneer of a high-rolling North Korean card shark was a man supplementing his income with a job as an informant to the CIA, said two people familiar with his activities. Kim Jong Nam provided information to the intelligence agency, often meeting his handlers in Singapore or Malaysia, the people said.

The revelation, detailed in the new book "The Great Successor" by Washington Post reporter Anna Fifield, one of the authors of this article, prompted a reaction from President Donald Trump, who when asked about the CIA's relationship with Kim's half brother said he couldn't confirm or deny the account.

"I know this: that the relationship is such that that wouldn't happen under my auspices, but I don't know about that. Nobody knows," he told reporters Tuesday.

The CIA declined to comment.

The secret relationship underscores the lengths to which the spy agency must go to uncover information about the world's most-closed society, where even an estranged half brother may be able to offer coveted information.

"It's very viable that he was a source," Bruce Klingner, a former CIA deputy division chief for Korea, said in an interview Wednesday. "After Kim Jong Il died, the U.S. government had very little information on Kim Jong Un, so there would've been a scramble for information, and strong interest in talking to the half brother."

Kim Jong Nam is believed to have met with an American intelligence agent on a Malaysian island a few days before he was killed in Kuala Lumpur's airport, according to a Malaysian official interviewed after the killing. The backpack he was wearing in the airport held $120,000 in cash, raising immediate suspicions of shadowy dealings.

"A wad of cash like that would seem reflective of an under-the-table relationship that is either of a criminal or intelligence nature," said Klingner, who joked that a payment of that magnitude would show that the "CIA pays its assets better than its employees."

What exactly Kim provided to U.S. officials, or to the South Korean and Chinese intelligence officials with whom he is also believed to have had relations, is unknown. But he is likely to have sought an additional source of income after the killing of his uncle, Jang Song-thaek, a person familiar with his finances said. Jang, a senior North Korean official who was executed in 2013 as Kim Jong Un consolidated power, spoke frequently with Kim Jong Nam during his exile and heavily subsidized his life in the resort of Macau, the person said.

It is possible that the young leader's quest for power and the execution of his uncle thrust Kim Jong Nam into the arms of foreign intelligence services as he tried to maintain his lifestyle. Klingner said intelligence officials probably would have asked Kim Jong Nam to interpret events inside North Korea.

"When we have assets with information on a hard target like North Korea, we'll try to get a sense of how they interpret recent actions," he said, noting his recent discussion with a North Korean defector about the North Korean leader's decision to launch short-range missiles.

Klingner noted that Kim Jong Nam did not seem to have a "political base in North Korea," so it is unclear how much information he would have had, but any details about how the regime functions would have been valuable. "It's useful to get a sense of how the regime gets information and how it interprets information," he said.

But Kim would have been sharing information at substantial risk to his own safety, given that he was already viewed as a succession threat by Kim Jong Un because of his status as Kim Jong Il's firstborn son.

In dealing with others, Kim Jong Nam sought to emphasize that he was contented living abroad, away from the temptations of power, where he had children with three women.

"He was a bit concerned about what would happen to him" after his brother took over, said one of his business associates, who spoke on the condition of anonymity to discuss Kim Jong Nam's feelings.

"He was happy living the life that he was living. He was happy that his children and wives and mistresses were not in North Korea."

In the years before he died, the estrangement between the regime and Kim Jong Nam became more apparent. Anthony Sahakian, who went to school with him in Switzerland and kept in touch, said it appeared that Kim Jong Nam was working for a living and was not being subsidized by the Kim regime. On his last trip to Geneva, he stayed at an Airbnb rather than an upscale hotel.

In 2009, when Kim Jong Il became noticeably frailer, Kim Jong Nam dismissed the idea that he would succeed his father, telling a Japanese TV crew that was tailing him: "Would I be dressed like this if I was the successor?" He was wearing sweatpants at the time.

His view of the totalitarian state also grew more negative as he lived abroad. After his father chose Kim Jong Un as his successor, the overlooked older brother said he was opposed in principle to third-generation leadership but wished his brother good luck. "I hope my brother does his best to make the lives of North Koreans better," he said, adding that he was happy to offer his help from abroad.

He grew even more critical of the regime in 2009, saying it was time for the country to "reform and open up" like China. His harshest condemnations came in 2012 after Kim Jong Un became leader. "I have my doubts about whether a person with only two years of grooming as a leader can govern," Kim Jong Nam wrote to a Japanese reporter at the time.

The life of this jet-setting international playboy ended in airport security footage of him looking overwhelmingly ordinary as a balding 45-year-old man, with no entourage and waiting to check himself in at the counter of Air Asia, a discount airline.

As he stood there, two women approached him, wiped different chemicals on his face and mouth and ran off to wash their hands. The chemical agents combined to form the deadly nerve agent VX.

Less than 15 minutes later he was dead.

Investigators later found 12 vials of antidote for poisons, including VX, on him the day he was murdered. It remains unclear why he never took any.