Taking a hardhearted stance with

心(こころ)を鬼(おに)にする means forcing yourself to act sternly even though you feel sympathy for the person affected.

Literal Meaning

This expression literally translates as “to turn one’s heart into an ogre”.

Usage Notes

The speaker suppresses compassion to do something they believe is necessary but harsh. A parent might use the expression before disciplining a child even though the punishment pains them.

It can also describe being strict with yourself. In either case, the point is the conflict between sympathy and a deliberate decision to stay firm.

Dictionary Definition

かわいそうだと思(おも)いながら、厳(きび)しい態度(たいど)をとる。

To take a harsh attitude (with someone) while feeling sorry (for them).

Goo Dictionary

Further Reading

Examples

Being strict about eating sweets with 心を鬼にする

Mie stands at the left of a classroom with her eyes shut. At the right, Komura shakes his lowered head, and his thoughts appear in a caption box and as free-floating text.
好きな子がめがねを忘れた » Volume 2 » Page 119

Having gained weight recently, Mie asks Komura to stop her from eating sweets at school, a difficult task as it’s White Day. Komura repeatedly stops Mie from eating the cookies and chocolate she’s received as gifts. His resolve weakens as he finds it adorable how Mie tries to sneak a bite whenever he’s not looking.

小村(こむら):
「で…でもダメだ! 三重(みえ)さんが一度(いちど)決(き)めたことを破(やぶ)らせては… 心(こころ)を鬼(おに)にしないと…!!」
“But, that's no good! If I let Mie break her decision... I have to be strict for her sake!”

Being strict with oneself and one's student with 心を鬼にする

Ms. Kobayashi, with bobbed hair and glasses, speaks in the right foreground, her face partly shadowed. Behind her, another person in glasses watches with an open mouth.
名探偵コナン » Volume 16 » Page 91

Conan’s classmates aren’t fond of their new teacher’s strict attitude. Ms. Kobayashi explains how at her last school, she couldn’t bring herself to be strict, and it allowed her students to get so out of control that students were injured in a fight.

小林(こばやし):
「だから、この学校(がっこう)では二度(にど)とあんな事(こと)は繰(く)り返(かえ)すまいと…」
“So, determined never to let anything like that happen again at this school...”
「心(こころ)を鬼(おに)にして自分(じぶん)にも生徒(せいと)にも厳(きび)しくしてきたの…」
“I hardened my heart and have been strict with myself and my students ever since...”

Club training with 心を鬼にする

Tamaki and the other host club members dash away from Haruhi, who stands behind them with a hand raised and a panicked face. A large だーっ sound effect streaks across the panel.
桜蘭高校ホスト部 » Volume 1 » Page 127

Renge wedges herself into the Ouran High School Host club, appointing herself the club’s manager. Due to her social status, Tamaki and the other wealthy club members are unable to object. Instead, they leave it to Haruhi to oust her.

環(たまき):
「これもホスト修行(しゅぎょう)だハルヒ!!」
“This, too, is host training, Haruhi!!”
「おとーさんは心(こころ)を鬼(おに)にするぞ!!」
“Dad is going to harden his heart!”