President Trump announced early on Oct. 2 that he and his wife, Melania, had tested positive for the novel coronavirus. (Video: The Washington Post, Photo: Amanda Voisard/The Washington Post)

It is behavior that has gotten college students kicked off their campuses, led business owners to be threatened with hefty fines and landed dozens of people in jail. But before announcing his positive coronavirus test result on Twitter early Friday, it was simply the norm for President Trump.

In the seven months since the outbreak first spread across the United States, he has flouted seemingly every basic health guideline put forth by his own government in response.

He repeatedly refused to wear a face mask, and held large rallies with hundreds of supporters who did the same, often in violation of local ordinances. He allowed the White House to continue its daily operations with scant social distancing, exposing himself to dozens of people who had taken few protections against the virus.

And again and again, he insisted such an approach was fine — because the White House was testing his close contacts every day, or because he was taking an antimalarial drug with no proven effect on healthy people exposed to the virus. Pressed on the issue during Tuesday’s presidential debate in Cleveland, he said, “So far, we have had no problem whatsoever."

Yet as the pandemic has carried on, killing more than 207,000 Americans, many have pointed to that pattern of medically risky behavior to explain Trump’s own infection with the virus.

Catch up on the most important pandemic developments at the end of the day with our free Coronavirus Updates newsletter

Vin Gupta, a pulmonologist at the University of Washington, said that the diagnosis was the inevitable consequence of Trump and his aides ignoring social distancing guidelines and failing to wear masks.

“The fact that this even occurred is a damning indictment [of] their months and months of misrepresenting good public health practice,” he told MSNBC’s Brian Williams. “This did not have to happen."

Now, Trump, a medically obese 74-year-old man whose age and weight may increase the risk of complications, must contend personally with the virus that he has spent much of his fourth year in office downplaying.

After he announced the test results early Friday morning, White House aides said all his political events would be canceled for the foreseeable future. Trump wrote on Twitter that he and first lady Melania Trump would “begin our quarantine and recovery process immediately.”

That is a swift reversal from the loose adherence to health guidelines that he has displayed for months.

In March, as his administration scrambled to contain an outbreak quickly spreading across the country, he urged Americans to practice social distancing at news conferences, where he and his aides often ignored that advice. Trump and members of his coronavirus task force were seen touching their faces, exchanging handshakes and congregating shoulder-to-shoulder behind the lectern.

With much of the country on lockdown, that behavior continued for months. In May, after news broke that two White Houses staffers had tested positive for the coronavirus, Trump told White House physician Sean P. Conley that he wanted to start taking hydroxychloroquine.

By then, the Food and Drug Administration had already warned against using the antimalarial drug outside a hospital setting or a clinical trial, as scientists noted the drug could in fact increase the risk of death among patients with heart problems.

But Trump demurred, noting that hydroxychloroquine had been approved to treat rheumatoid arthritis and other ailments for decades. Following discussions with Conley, they decided that “the potential benefit from treatment outweighed the relative risks,” the doctor wrote at the time.

“I think it’s good. I’ve heard a lot of good stories,” Trump said. “And if it’s not good, I’ll tell you right. I’m not going to get hurt by it.”

‘INFECTED’: How the media scrambled to cover Trump and the first lady’s positive coronavirus tests

Weeks later, a study in the New England Journal of Medicine reported that the drug did not prevent healthy people from getting covid-19 if they had been exposed to someone with the virus.

In April, when the Centers for Disease Control and Prevention released new recommendations on face masks, Trump again contradicted the science. During a visit the following month to a Michigan auto plant, he removed his mask before speaking to reporters, saying he did not pose a risk because he had been tested for the virus that morning.

At one point, he appeared to suddenly change course, tweeting a photo of himself with his face covered and calling it a “patriotic” act. But later in the summer, it was back to his old routines. He mocked former vice president Joe Biden for wearing a mask, insisting that reporters remove theirs at news conferences and effectively abandoned a short-lived mask policy at the White House.

As cases and deaths rapidly spread across the country, and hotspots shifted from dense, left-leaning cities such as New York to his geographic base in the Sun Belt and Midwest, Trump traveled to both of those regions to stage massive rallies — where social distancing rules were repeatedly ignored and neither he nor his supporters wore masks.

At a June event in Tulsa, supporters were reportedly instructed to cover their faces while entering the arena, but allowed to take masks off inside, where many stood standing shoulder-to-shoulder despite plenty of empty seats.

Last month in North Carolina, he jeered the state’s limit on crowd sizes, suggesting that his airport rallies had received less leeway to break similar rules than racial justice demonstrations.

“We call you peaceful protesters, you know why?” Trump told the group. “Because they have rules in these Democrat-run states that if you’re campaigning, you cannot have more than five people. They did that for me.”

Hope Hicks, a top aide who traveled extensively with the president and met with him for long hours of debate prep earlier this week, was also often pictured without a mask around him. On Thursday, after White House officials had learned of Hicks testing positive, Trump did not immediately isolate, as recommended by the CDC.

Instead, he boarded a plane to New Jersey, where he attended a fundraiser and delivered a speech while standing close to dozens of other people.