A Madison man has been sentenced to four years in prison for dealing the illegal drug called Ecstasy.

Jonathan Britton, 29, was sentenced by U.S. District Judge James Peterson in federal court in Madison on Tuesday.

Britton pleaded guilty in August.

According to the U.S. Attorney's Office, Britton sold a quarter-ounce of Ecstasy to an undercover agent on Sept. 14, 2016.

The judge said he sentenced Britton to four years to protect the public and to give him the time to get rehabilitated.

The investigation was conducted by the Dane County Narcotics Task Force and the Bureau of Alcohol, Tobacco, Firearms and Explosives.