Peel and finely dice the onions and garlic. Heat the oil in a pan. Fry the minced meat for about 10 minutes until crumbly. After about 5 minutes frying time add onions and garlic. Stir in tomato paste and sauté briefly.
Deglaze with wine. Bring to the boil and simmer while stirring for about 5 minutes. Season to taste with salt, pepper and basil.
Meanwhile cook the pasta in 3-4 l boiling salted water (approx. 1 teaspoon salt per litre) according to the instructions on the packet. Heat butter in a pot. Lightly sauté the flour in it. Add milk while stirring, bring to the boil and simmer for 3-5 minutes.
Season to taste with salt and pepper. Grate cheese and melt half of it in the sauce.
Preheat oven (electric cooker: 200 °C/circulating air: 175 °C/gas: see manufacturer). Grease a casserole dish and spread the chopped sauce in it. Drain the pasta, put it back into the pot and mix with the cheese sauce.
Put the pasta with the cheese sauce in the mould and sprinkle with the rest of the cheese. Bake in a hot oven for about 30 minutes.