The maker of a smartphone app once marketed to help catch cheating lovers by listening in on phone calls and tracking locations was ordered Tuesday to pay a $500,000 fine — a win for federal prosecutors that might spur more legal action against producers of so-called stalker apps.

Hammad Akbar, 31, of Lahore, Pakistan, admitted in the U.S. District Court for the Eastern District of Virginia that he broke the law, albeit unknowingly, in advertising and selling the Stealth­Genie app, which allowed users to surreptitiously monitor the activities of those whose phones had the program installed. The case against Akbar — the chief executive of the company that made Stealth­Genie — was the first of its kind, but it is notable because the app is hardly the only smartphone surveillance technology on the market.

Akbar, a software engineer and citizen of Denmark, said in court that he did not know he was violating U.S. law in selling the app and that he was “extremely sorry” to have done so. He pleaded guilty to selling and advertising an interception device.

“Had I known I was breaking the law, I would not have done it,” Akbar said.

Advocates for victims of domestic violence have long urged authorities to crack down on such apps — which they say are used frequently by those who abuse their spouses. Tuesday’s plea agreement and heavy fine send the message that those who peddle the technology can be successfully prosecuted.

Though U.S. District Judge ­Leonie M. Brinkema gave Akbar a prison sentence of only time served — he spent 10 days in jail after his arrest before he was able to post bond — federal prosecutors and Brinkema said others, including lawyers, should take note of the case.

“This is the type of crime that the Justice Department takes very seriously,” prosecutor ­William Hall said in court.

StealthGenie, which cost about $100 to $200 a year for a “Platinum” version, allowed users to monitor almost anything on a target’s phone, including photos, calendar entries and contacts. Calls could be recorded and listened to later, and the microphone could be activated so that the user could simply listen to the ambient sounds of a target’s daily life, according to a cached version of the company Web site. The app also plotted the movement of a target on an online map.

Like its competitors, Stealth­Genie required users to gain physical control of a target’s phone so that the app could be installed, but it would operate in secret after that. Such surveillance is typically allowed only for law enforcement, although it would be legal for parents to track children or for caregivers to track elderly relatives with their consent.

For his part, Akbar came off as a somewhat sympathetic face of the crime. The son of a businessman, Akbar moved to Lahore in 2010 to start a software development company, borrowing money from his family and working around the clock to get his venture off the ground, his attorneys wrote in court papers. Akbar said in court that he developed the StealthGenie app with another person, and he admitted leading the companies that sold and advertised it.

Akbar eventually took steps to deter users from monitoring cheating spouses, his attorneys wrote, and he sought the advice of another attorney to see if his app was legal. The attorney assured him — wrongly — that it was, Akbar’s attorneys wrote.

That, though, was no defense to the crime, Akbar and his attorneys acknowledged in court. Akbar said he regretted the shame he brought upon his family and said he suffered panic attacks during the days he spent in jail.

“The last two months have been extremely hard for me,” Akbar said.

Akbar was arrested in September after he flew to Los Angeles on a business trip. The charges against him seemed to be the culmination of a three-year investigation in which federal authorities purchased the app undercover and performed a technical analysis. Prosecutors also shuttered the app’s Web site, and they are working to make sure it remains offline. Akbar’s attorneys said in court that they do not object to that outcome, but they cannot control the actions of those who worked with Akbar on the technology.

Prosecutors wrote in court filings that as of December 2011, hundreds of people across the world had been monitored by the app, and they estimated that tens of thousands might have been monitored in the years that followed.

J. Patrick Rowan, an attorney for Akbar, said in court that Akbar has agreed to pay the fine as soon as he can get the money wired from overseas — which should happen in the coming days. After that, prosecutors and defense attorneys said, FBI agents will escort Akbar to the airport, and he will voluntarily fly out of the country.

Rowan declined to comment after the hearing.