HAMILTON -- A Canadian man accused in a massive hack of Yahoo emails is telling an Ontario court he had a business that protected websites from cyberattacks.

Karim Baratov is testifying at his bail hearing in Hamilton and says he earned about $90,000 from his business in its first year, but earned less in later years.

The 22-year-old was arrested under the Extradition Act last month.

U.S. authorities say Baratov and three others -- two of them allegedly officers of Russia's Federal Security Service -- were indicted for computer hacking, economic espionage and other crimes.

Crown attorney Heather Graham says that at the time of Baratov's arrest, police found more than $30,000 in his home.

Baratov has told the court that he was keeping the money as savings.

According to a sworn affidavit by a Toronto police officer involved in the case, Baratov has no record of legitimate employment.

But in his testimony, Baratov said he started a company in 2014, earning money by hosting webspace for small businesses and protecting websites from hackers.