A young Marine once "hacked" then-Maj. Gen. Jim Mattis's computer and sent an email from the two-star's account to a female Marine that the private first class had a crush on, the former defense secretary told a crowd at a luncheon Wednesday near his hometown.

"By the way, Pfc. So-and-So is the greatest Marine in the entire division," read the message to the young woman, Mattis told the nearly 1,000 people at the sold-out event in a convention center in Kennewick, Wash., before adding: "Great initiative, not the best judgment."

The anecdote was meant to illustrate the qualities of initiative and assertiveness that the Marine Corps seeks to instill in its members, the Tri-City Herald reported.

"It's like all organizations in the world, the leadership of the Marine Corps gets the behavior they reward," said Mattis, who has himself come to embody those characteristics.

He's earned a reputation as an aggressive leader -- and the nickname "Mad Dog," though he reportedly isn't fond of the moniker -- and is revered by many Marines and others.

The email incident appears to have happened while he was leading the storied 1st Marine Division. In that same post in March 2003, his rare battlefield firing of a regimental commander as the Marines advanced on Baghdad grabbed headlines. The colonel's reluctance to take on more risk for his men to speed up the offensive led to the dismissal, Mattis wrote in his new bestselling memoir "Call Sign Chaos: Learning to Lead."

Mattis himself was relieved of command as head of Central Command under President Barack Obama in 2013, in part, apparently, because his strong views and blunt speaking put him at odds with the administration.

Last December, Mattis resigned as defense secretary after President Donald Trump called for the withdrawal of U.S. troops from Syria, where they had been assisting Kurdish-led forces battling the Islamic State group.

The retired general has been in the spotlight again in recent weeks promoting his book, written with author Bing West and titled with his preferred nom de guerre, Chaos, which he earned as a colonel leading Marines in Afghanistan. It reportedly stands for "the colonel has an outstanding solution."

Though he rose through the ranks as a Marine and came out of retirement to lead the Defense Department as a civilian, Mattis initially considered a teaching career, he told the crowd this week in southeastern Washington, where he was raised.

His talk focused on what he had learned in more than 40 years of service, such as distinguishing between a mistake and a lack of discipline, as well as giving subordinates ownership of their work by clearly articulating objectives and letting them plan how to accomplish them, the Tri-City Herald reported.

The record-breaking audience for the luncheon, which was part of a monthly series organized by the Tri-Cities Regional Chamber of Commerce, included active duty service members and veterans, a local NBC station reported. Mattis answered questions on leadership related to both the civilian workplace and the military.

But what happened to that young Marine who sent the ill-advised email?

"He was young enough to make a mistake like that, which would have been an ethical mistake up above," Mattis said. "He got punished by being assigned to my personal staff."

It's unclear if he got the girl.

Read more: Navy May Be Close to Getting First Female Special Ops Boat Crewmen