Mac users might not be as safe as they think.

Apple computers have been successfully targeted by malicious software called "ransomware" for the first time, according to security researchers.

Palo Alto Networks said it spotted the ransomware on OS X on March 4, and reported the issue to Apple the same day.

Apple, which did not immediately respond to CNNMoney's requests for comment, took steps to protect users after being alerted to the problem, Palo Alto said.

Ransomware is software that hijacks a computer, and locks a user's files until a ransom is paid. The program in question, dubbed keRanger, requires victims to pay one Bitcoin, which is a little more than $400, to retrieve their files.

Related: Apple vs. the FBI...in 2 minutes

In this case, hackers managed to infect two versions of a program that installs a popular file-sharing tool called "Transmission" on Macs. Palo Alto said this is the first time a fully functional version of ransomware has been detected in Apple's operating system.

The ransomware infection comes at a time when the security of Apple's products have come under intense scrutiny. The tech company is engaged in a major standoff with the U.S. government over the security of its iPhones.

-- Jose Pagliery contributed reporting.